fix topic view selection crash on centerAndReveal
This commit is contained in:
parent
4478ca43b8
commit
2c0ae7e84d
2 changed files with 16 additions and 6 deletions
|
@ -103,10 +103,13 @@ Metamaps.Listeners = {
|
|||
centerAndReveal: function(nodes, opts) {
|
||||
if (nodes.length < 1) return
|
||||
var node = nodes[nodes.length - 1]
|
||||
if (opts.center) {
|
||||
if (opts.center && opts.reveal) {
|
||||
Metamaps.Topic.centerOn(node.id, function() {
|
||||
Metamaps.Topic.fetchRelatives(node)
|
||||
})
|
||||
} else if (opts.center) {
|
||||
Metamaps.Topic.centerOn(node.id)
|
||||
}
|
||||
if (opts.reveal) {
|
||||
} else if (opts.reveal) {
|
||||
Metamaps.Topic.fetchRelatives(node)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,12 +99,13 @@ Metamaps.Topic = {
|
|||
Metamaps.Filter.close()
|
||||
}
|
||||
},
|
||||
centerOn: function (nodeid) {
|
||||
centerOn: function (nodeid, callback) {
|
||||
// don't clash with fetchRelatives
|
||||
if (!Metamaps.Visualize.mGraph.busy) {
|
||||
Metamaps.Visualize.mGraph.onClick(nodeid, {
|
||||
hideLabels: false,
|
||||
duration: 1000,
|
||||
onComplete: function () {}
|
||||
onComplete: callback
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -117,7 +118,13 @@ Metamaps.Topic = {
|
|||
|
||||
var topic = node.getData('topic')
|
||||
|
||||
var successCallback = function (data) {
|
||||
var successCallback;
|
||||
successCallback = function (data) {
|
||||
if (Metamaps.Visualize.mGraph.busy) {
|
||||
// don't clash with centerOn
|
||||
window.setTimeout(function() { successCallback(data) }, 100)
|
||||
return
|
||||
}
|
||||
if (data.creators.length > 0) Metamaps.Creators.add(data.creators)
|
||||
if (data.topics.length > 0) Metamaps.Topics.add(data.topics)
|
||||
if (data.synapses.length > 0) Metamaps.Synapses.add(data.synapses)
|
||||
|
|
Loading…
Add table
Reference in a new issue