diff --git a/frontend/src/Metamaps/Cable.js b/frontend/src/Metamaps/Cable.js index 02f6dabd..0c4a4680 100644 --- a/frontend/src/Metamaps/Cable.js +++ b/frontend/src/Metamaps/Cable.js @@ -28,7 +28,7 @@ const Cable = { }, unsubscribeFromMap: () => { let self = Cable - self.sub.unsubscribe() + self.sub && self.sub.unsubscribe() delete self.sub }, synapseAdded: event => { diff --git a/frontend/src/Metamaps/Engine.js b/frontend/src/Metamaps/Engine.js index 39215ea9..06518532 100644 --- a/frontend/src/Metamaps/Engine.js +++ b/frontend/src/Metamaps/Engine.js @@ -36,7 +36,7 @@ const Engine = { Engine.runner = Matter.Runner.run(Engine.engine) }, endActiveMap: () => { - Runner.stop(Engine.runner) + Engine.runner && Runner.stop(Engine.runner) Matter.Engine.clear(Engine.engine) }, setNodePos: (id, x, y) => { diff --git a/frontend/src/Metamaps/Visualize.js b/frontend/src/Metamaps/Visualize.js index d38c0e8f..15247d36 100644 --- a/frontend/src/Metamaps/Visualize.js +++ b/frontend/src/Metamaps/Visualize.js @@ -159,6 +159,8 @@ const Visualize = { function runAnimation() { Loading.hide() + $('#new_topic').show() + $('#topic_name').focus() // load JSON data, if it's not empty if (!self.loadLater) { // load JSON data. @@ -178,8 +180,6 @@ const Visualize = { } else if (self.type === 'ForceDirected') { self.mGraph.plot() Engine.run(true) - $('#new_topic').show() - $('#topic_name').focus() } else if (self.type === 'ForceDirected3D') { self.mGraph.animate(JIT.ForceDirected.animateFDLayout) }