fetch siblings & center topic keyboard shortcuts - fixes #466
This commit is contained in:
parent
52cbd57367
commit
5d66c72941
2 changed files with 56 additions and 16 deletions
|
@ -699,13 +699,17 @@ Metamaps.Backbone.init = function () {
|
|||
// attach collection event listeners
|
||||
self.attachCollectionEvents = function () {
|
||||
Metamaps.Topics.on('add remove', function (topic) {
|
||||
if (Metamaps.Active.Map) {
|
||||
Metamaps.Map.InfoBox.updateNumbers()
|
||||
}
|
||||
Metamaps.Filter.checkMetacodes()
|
||||
Metamaps.Filter.checkMappers()
|
||||
})
|
||||
|
||||
Metamaps.Synapses.on('add remove', function (synapse) {
|
||||
if (Metamaps.Active.Map) {
|
||||
Metamaps.Map.InfoBox.updateNumbers()
|
||||
}
|
||||
Metamaps.Filter.checkSynapses()
|
||||
Metamaps.Filter.checkMappers()
|
||||
})
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
*/
|
||||
Metamaps.Listeners = {
|
||||
init: function () {
|
||||
var self = this
|
||||
$(document).on('keydown', function (e) {
|
||||
if (!(Metamaps.Active.Map || Metamaps.Active.Topic)) return
|
||||
|
||||
|
@ -35,6 +36,12 @@ Metamaps.Listeners = {
|
|||
Metamaps.Visualize.mGraph.plot()
|
||||
}
|
||||
|
||||
break
|
||||
case 68: // if d or D is pressed
|
||||
if (e.ctrlKey) {
|
||||
e.preventDefault()
|
||||
Metamaps.Control.deleteSelected()
|
||||
}
|
||||
break
|
||||
case 69: // if e or E is pressed
|
||||
if (e.ctrlKey) {
|
||||
|
@ -44,19 +51,6 @@ Metamaps.Listeners = {
|
|||
}
|
||||
}
|
||||
break
|
||||
case 77: // if m or M is pressed
|
||||
if (e.ctrlKey) {
|
||||
e.preventDefault()
|
||||
Metamaps.Control.removeSelectedNodes()
|
||||
Metamaps.Control.removeSelectedEdges()
|
||||
}
|
||||
break
|
||||
case 68: // if d or D is pressed
|
||||
if (e.ctrlKey) {
|
||||
e.preventDefault()
|
||||
Metamaps.Control.deleteSelected()
|
||||
}
|
||||
break
|
||||
case 72: // if h or H is pressed
|
||||
if (e.ctrlKey) {
|
||||
e.preventDefault()
|
||||
|
@ -64,8 +58,40 @@ Metamaps.Listeners = {
|
|||
Metamaps.Control.hideSelectedEdges()
|
||||
}
|
||||
break
|
||||
case 77: // if m or M is pressed
|
||||
if (e.ctrlKey) {
|
||||
e.preventDefault()
|
||||
Metamaps.Control.removeSelectedNodes()
|
||||
Metamaps.Control.removeSelectedEdges()
|
||||
}
|
||||
break
|
||||
case 84: // if t or T is pressed
|
||||
if (e.ctrlKey && Metamaps.Active.Topic) {
|
||||
self.centerAndReveal(Metamaps.Selected.Nodes, {
|
||||
center: false,
|
||||
reveal: true
|
||||
})
|
||||
}
|
||||
break
|
||||
case 85: // if u or U is pressed
|
||||
if (e.ctrlKey && Metamaps.Active.Topic) {
|
||||
self.centerAndReveal(Metamaps.Selected.Nodes, {
|
||||
center: true,
|
||||
reveal: false
|
||||
})
|
||||
}
|
||||
break
|
||||
case 89: // if y or Y is pressed
|
||||
if (e.ctrlKey && Metamaps.Active.Topic) {
|
||||
self.centerAndReveal(Metamaps.Selected.Nodes, {
|
||||
center: true,
|
||||
reveal: true
|
||||
})
|
||||
}
|
||||
break
|
||||
default:
|
||||
break; // alert(e.which)
|
||||
// console.log(e.which)
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -74,5 +100,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.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
|
||||
|
|
Loading…
Add table
Reference in a new issue