* fetch siblings & center topic keyboard shortcuts - fixes #466 * add keyboard shortcut labels * update keyboard shortcuts to Ctrl+E, Ctrl+R, and Ctrl+T, and update docs * zoom extents back to Ctrl+E and use e.preventDefault
This commit is contained in:
parent
3050f1413a
commit
9cedf69432
5 changed files with 61 additions and 22 deletions
|
@ -1335,7 +1335,7 @@ Metamaps.JIT = {
|
||||||
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-delete ' + disabled + '"><div class="rc-icon"></div>Delete<div class="rc-keyboard">Ctrl+D</div></li>'
|
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-delete ' + disabled + '"><div class="rc-icon"></div>Delete<div class="rc-keyboard">Ctrl+D</div></li>'
|
||||||
|
|
||||||
if (Metamaps.Active.Topic) {
|
if (Metamaps.Active.Topic) {
|
||||||
menustring += '<li class="rc-center"><div class="rc-icon"></div>Center this topic</li>'
|
menustring += '<li class="rc-center"><div class="rc-icon"></div>Center this topic<div class="rc-keyboard">Ctrl+E</div></li>'
|
||||||
}
|
}
|
||||||
menustring += '<li class="rc-popout"><div class="rc-icon"></div>Open in new tab</li>'
|
menustring += '<li class="rc-popout"><div class="rc-icon"></div>Open in new tab</li>'
|
||||||
if (Metamaps.Active.Mapper) {
|
if (Metamaps.Active.Mapper) {
|
||||||
|
@ -1360,10 +1360,10 @@ Metamaps.JIT = {
|
||||||
// set up the get sibling menu as a "lazy load"
|
// set up the get sibling menu as a "lazy load"
|
||||||
// only fill in the submenu when they hover over the get siblings list item
|
// only fill in the submenu when they hover over the get siblings list item
|
||||||
var siblingMenu = '<ul id="fetchSiblingList"> \
|
var siblingMenu = '<ul id="fetchSiblingList"> \
|
||||||
<li class="fetchAll">All</li> \
|
<li class="fetchAll">All<div class="rc-keyboard">Ctrl+R</div></li> \
|
||||||
<li id="loadingSiblings"></li> \
|
<li id="loadingSiblings"></li> \
|
||||||
</ul>'
|
</ul>'
|
||||||
menustring += '<li class="rc-siblings"><div class="rc-icon"></div>Get siblings' + siblingMenu + '<div class="expandLi"></div></li>'
|
menustring += '<li class="rc-siblings"><div class="rc-icon"></div>Reveal siblings' + siblingMenu + '<div class="expandLi"></div></li>'
|
||||||
}
|
}
|
||||||
|
|
||||||
menustring += '</ul>'
|
menustring += '</ul>'
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
*/
|
*/
|
||||||
Metamaps.Listeners = {
|
Metamaps.Listeners = {
|
||||||
init: function () {
|
init: function () {
|
||||||
|
var self = this
|
||||||
$(document).on('keydown', function (e) {
|
$(document).on('keydown', function (e) {
|
||||||
if (!(Metamaps.Active.Map || Metamaps.Active.Topic)) return
|
if (!(Metamaps.Active.Map || Metamaps.Active.Topic)) return
|
||||||
|
|
||||||
|
@ -35,21 +36,6 @@ Metamaps.Listeners = {
|
||||||
Metamaps.Visualize.mGraph.plot()
|
Metamaps.Visualize.mGraph.plot()
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
|
||||||
case 69: // if e or E is pressed
|
|
||||||
if (e.ctrlKey) {
|
|
||||||
e.preventDefault()
|
|
||||||
if (Metamaps.Active.Map) {
|
|
||||||
Metamaps.JIT.zoomExtents(null, Metamaps.Visualize.mGraph.canvas)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case 77: // if m or M is pressed
|
|
||||||
if (e.ctrlKey) {
|
|
||||||
e.preventDefault()
|
|
||||||
Metamaps.Control.removeSelectedNodes()
|
|
||||||
Metamaps.Control.removeSelectedEdges()
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
case 68: // if d or D is pressed
|
case 68: // if d or D is pressed
|
||||||
if (e.ctrlKey) {
|
if (e.ctrlKey) {
|
||||||
|
@ -57,6 +43,19 @@ Metamaps.Listeners = {
|
||||||
Metamaps.Control.deleteSelected()
|
Metamaps.Control.deleteSelected()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case 69: // if e or E is pressed
|
||||||
|
if (e.ctrlKey) {
|
||||||
|
e.preventDefault()
|
||||||
|
if (Metamaps.Active.Topic) {
|
||||||
|
self.centerAndReveal(Metamaps.Selected.Nodes, {
|
||||||
|
center: true,
|
||||||
|
reveal: false
|
||||||
|
})
|
||||||
|
} else if (Metamaps.Active.Map) {
|
||||||
|
Metamaps.JIT.zoomExtents(null, Metamaps.Visualize.mGraph.canvas)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
case 72: // if h or H is pressed
|
case 72: // if h or H is pressed
|
||||||
if (e.ctrlKey) {
|
if (e.ctrlKey) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
@ -64,8 +63,34 @@ Metamaps.Listeners = {
|
||||||
Metamaps.Control.hideSelectedEdges()
|
Metamaps.Control.hideSelectedEdges()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case 77: // if m or M is pressed
|
||||||
|
if (e.ctrlKey) {
|
||||||
|
e.preventDefault()
|
||||||
|
Metamaps.Control.removeSelectedNodes()
|
||||||
|
Metamaps.Control.removeSelectedEdges()
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 82: // if r or R is pressed
|
||||||
|
if (e.ctrlKey && Metamaps.Active.Topic) {
|
||||||
|
e.preventDefault()
|
||||||
|
self.centerAndReveal(Metamaps.Selected.Nodes, {
|
||||||
|
center: false,
|
||||||
|
reveal: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 84: // if t or T is pressed
|
||||||
|
if (e.ctrlKey && Metamaps.Active.Topic) {
|
||||||
|
e.preventDefault()
|
||||||
|
self.centerAndReveal(Metamaps.Selected.Nodes, {
|
||||||
|
center: true,
|
||||||
|
reveal: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
break; // alert(e.which)
|
// console.log(e.which)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -74,5 +99,15 @@ Metamaps.Listeners = {
|
||||||
if ((Metamaps.Active.Map || Metamaps.Active.Topic) && Metamaps.Famous && Metamaps.Famous.maps.surf) Metamaps.Famous.maps.reposition()
|
if ((Metamaps.Active.Map || Metamaps.Active.Topic) && Metamaps.Famous && Metamaps.Famous.maps.surf) Metamaps.Famous.maps.reposition()
|
||||||
if (Metamaps.Active.Map && Metamaps.Realtime.inConversation) Metamaps.Realtime.positionVideos()
|
if (Metamaps.Active.Map && Metamaps.Realtime.inConversation) Metamaps.Realtime.positionVideos()
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
centerAndReveal: function(nodes, opts) {
|
||||||
|
if (nodes.length < 1) return
|
||||||
|
var node = nodes[nodes.length - 1]
|
||||||
|
if (opts.center) {
|
||||||
|
Metamaps.Topic.centerOn(node.id)
|
||||||
|
}
|
||||||
|
if (opts.reveal) {
|
||||||
|
Metamaps.Topic.fetchRelatives(node)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}; // end Metamaps.Listeners
|
}; // end Metamaps.Listeners
|
||||||
|
|
|
@ -673,6 +673,8 @@ Metamaps.Map.InfoBox = {
|
||||||
return string
|
return string
|
||||||
},
|
},
|
||||||
updateNumbers: function () {
|
updateNumbers: function () {
|
||||||
|
if (!Metamaps.Active.Map) return
|
||||||
|
|
||||||
var self = Metamaps.Map.InfoBox
|
var self = Metamaps.Map.InfoBox
|
||||||
var mapper = Metamaps.Active.Mapper
|
var mapper = Metamaps.Active.Mapper
|
||||||
var relevantPeople = Metamaps.Active.Map.get('permission') === 'commons' ? Metamaps.Mappers : Metamaps.Collaborators
|
var relevantPeople = Metamaps.Active.Map.get('permission') === 'commons' ? Metamaps.Mappers : Metamaps.Collaborators
|
||||||
|
|
|
@ -1249,8 +1249,9 @@ h3.filterBox {
|
||||||
.rightclickmenu .rc-metacode > ul > li,
|
.rightclickmenu .rc-metacode > ul > li,
|
||||||
.rightclickmenu .rc-siblings > ul > li {
|
.rightclickmenu .rc-siblings > ul > li {
|
||||||
padding: 6px 24px 6px 8px;
|
padding: 6px 24px 6px 8px;
|
||||||
width: auto;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
width: auto;
|
||||||
|
min-width: 5em;
|
||||||
}
|
}
|
||||||
.rightclickmenu .rc-metacode ul ul,
|
.rightclickmenu .rc-metacode ul ul,
|
||||||
.rightclickmenu .rc-siblings ul ul {
|
.rightclickmenu .rc-siblings ul ul {
|
||||||
|
|
|
@ -26,8 +26,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div id="csTopicView">
|
<div id="csTopicView">
|
||||||
<div class="csItem"><span class="csTitle">Recenter Topics around chosen Topic:</span> Alt + click on the topic OR Right-click + 'center this topic'</div>
|
<div class="csItem"><span class="csTitle">Recenter Topics around chosen Topic:</span> Alt + click on the topic OR Ctrl + E</div>
|
||||||
|
<div class="csItem"><span class="csTitle">Reveal the siblings for a Topic:</span> Right-click and choose 'Reveal siblings' OR Ctrl + R</div>
|
||||||
|
<div class="csItem"><span class="csTitle">Center topic and reveal siblings:</span> Ctrl + T</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="csCreatingTopics">
|
<div id="csCreatingTopics">
|
||||||
|
|
Loading…
Add table
Reference in a new issue