From 1b3942b2a08594dd18cd21f0de8d7f4cc86419b0 Mon Sep 17 00:00:00 2001
From: Robert Best <chessscholar@gmail.com>
Date: Fri, 10 Mar 2017 22:53:14 +0000
Subject: [PATCH] minor fixes as requested

---
 frontend/src/Metamaps/Control.js   |  8 +++---
 frontend/src/Metamaps/Listeners.js |  6 ++---
 frontend/src/Metamaps/Util.js      | 42 +++++++++++++++---------------
 3 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/frontend/src/Metamaps/Control.js b/frontend/src/Metamaps/Control.js
index d66013d7..81b4b39a 100644
--- a/frontend/src/Metamaps/Control.js
+++ b/frontend/src/Metamaps/Control.js
@@ -21,17 +21,17 @@ const Control = {
     Selected.Nodes.push(node)
   },
   selectNeighbors: function() {
-    if(Selected.Nodes.length > 0){
+    if (Selected.Nodes.length > 0) {
       //For each selected node, select all connected node and the synapses too
       Selected.Nodes.forEach((item) => {
-        if(Visualize.mGraph.graph.getNode(item.id).adjacencies){
-          for(var adjID in Visualize.mGraph.graph.getNode(item.id).adjacencies){
+        if (Visualize.mGraph.graph.getNode(item.id).adjacencies) {
+          for (const adjID in Visualize.mGraph.graph.getNode(item.id).adjacencies) {
             Control.selectNode(Visualize.mGraph.graph.getNode(adjID))
             Control.selectEdge(Visualize.mGraph.graph.getNode(item.id).adjacencies[adjID])
           }
         }
       })
-      
+
       Visualize.mGraph.plot()
     }
   },
diff --git a/frontend/src/Metamaps/Listeners.js b/frontend/src/Metamaps/Listeners.js
index 301e720b..4a2a1f56 100644
--- a/frontend/src/Metamaps/Listeners.js
+++ b/frontend/src/Metamaps/Listeners.js
@@ -20,7 +20,7 @@ const Listeners = {
       if (!(Active.Map || Active.Topic)) return
 
       const onCanvas = e.target.tagName === 'BODY'
-      
+
       switch (e.which) {
         case 13: // if enter key is pressed
           // prevent topic creation if sending a message
@@ -32,12 +32,12 @@ const Listeners = {
           JIT.escKeyHandler()
           break
         case 38: // if UP key is pressed
-          if(e.ctrlKey && e.shiftKey){
+          if ((e.ctrlKey || e.metaKey) && e.shiftKey){
             Control.selectNeighbors()
           }
           break
         case 46: // if DEL is pressed
-          if(e.target.tagName !== "INPUT" && e.target.tagName !== "TEXTAREA" && (Selected.Nodes.length + Selected.Edges.length) > 0){
+          if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && (Selected.Nodes.length + Selected.Edges.length) > 0) {
             e.preventDefault()
             Control.removeSelectedNodes()
             Control.removeSelectedEdges()
diff --git a/frontend/src/Metamaps/Util.js b/frontend/src/Metamaps/Util.js
index e371e4e0..2bc49159 100644
--- a/frontend/src/Metamaps/Util.js
+++ b/frontend/src/Metamaps/Util.js
@@ -204,31 +204,31 @@ const Util = {
   },
   zoomOnPoint: function(graph, ans, zoomPoint) {
     var s = graph.canvas.getSize(),
-          p = graph.canvas.getPos(),
-          ox = graph.canvas.translateOffsetX,
-          oy = graph.canvas.translateOffsetY,
-          sx = graph.canvas.scaleOffsetX,
-          sy = graph.canvas.scaleOffsetY;
-	    
-      var pointerCoordX = (zoomPoint.x - p.x - s.width / 2 - ox) * (1 / sx),
-          pointerCoordY = (zoomPoint.y - p.y - s.height / 2 - oy) * (1 / sy);
-
-      //This translates the canvas to be centred over the zoomPoint, then the canvas is zoomed as intended.
-      graph.canvas.translate(-pointerCoordX,-pointerCoordY);
-      graph.canvas.scale(ans, ans);
-      
-      //Get the canvas attributes again now that is has changed
-      s = graph.canvas.getSize(),
       p = graph.canvas.getPos(),
       ox = graph.canvas.translateOffsetX,
       oy = graph.canvas.translateOffsetY,
       sx = graph.canvas.scaleOffsetX,
-      sy = graph.canvas.scaleOffsetY;
-      var newX = (zoomPoint.x - p.x - s.width / 2 - ox) * (1 / sx),
-          newY = (zoomPoint.y - p.y - s.height / 2 - oy) * (1 / sy);
-          
-      //Translate the canvas to put the pointer back over top the same coordinate it was over before
-      graph.canvas.translate(newX-pointerCoordX,newY-pointerCoordY);
+      sy = graph.canvas.scaleOffsetY
+
+    var pointerCoordX = (zoomPoint.x - p.x - s.width / 2 - ox) * (1 / sx),
+      pointerCoordY = (zoomPoint.y - p.y - s.height / 2 - oy) * (1 / sy)
+
+      // This translates the canvas to be centred over the zoomPoint, then the canvas is zoomed as intended.
+    graph.canvas.translate(-pointerCoordX, -pointerCoordY)
+    graph.canvas.scale(ans, ans)
+
+      // Get the canvas attributes again now that is has changed
+    s = graph.canvas.getSize(),
+      p = graph.canvas.getPos(),
+      ox = graph.canvas.translateOffsetX,
+      oy = graph.canvas.translateOffsetY,
+      sx = graph.canvas.scaleOffsetX,
+      sy = graph.canvas.scaleOffsetY
+    var newX = (zoomPoint.x - p.x - s.width / 2 - ox) * (1 / sx),
+      newY = (zoomPoint.y - p.y - s.height / 2 - oy) * (1 / sy)
+
+      // Translate the canvas to put the pointer back over top the same coordinate it was over before
+    graph.canvas.translate(newX - pointerCoordX, newY - pointerCoordY)
   }
 }