From 08f89ee630b35e44625ff4da929664df8c4a2933 Mon Sep 17 00:00:00 2001 From: Robert Best Date: Thu, 6 Oct 2016 23:56:39 -0400 Subject: [PATCH] Update Listeners.js --- frontend/src/Metamaps/Listeners.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/Metamaps/Listeners.js b/frontend/src/Metamaps/Listeners.js index bd73e59b..48e50a69 100644 --- a/frontend/src/Metamaps/Listeners.js +++ b/frontend/src/Metamaps/Listeners.js @@ -124,6 +124,7 @@ const Listeners = { $(window).resize(function () { if (Visualize && Visualize.mGraph){ + //Find the current canvas scale and map-coordinate at the centre of the user's screen var canvas = Visualize.mGraph.canvas, scaleX = canvas.scaleOffsetX, scaleY = canvas.scaleOffsetY, @@ -131,8 +132,10 @@ const Listeners = { centrePixY = Visualize.mGraph.canvas.canvases[0].size.height / 2, centreCoords = Util.pixelsToCoords({x:centrePixX ,y:centrePixY}); + //Resize the canvas to fill the new indow size, based on how JIT works, this also resets the map back to scale 1 and tranlations = 0 Visualize.mGraph.canvas.resize($(window).width(), $(window).height()) + //Return the map to the original scale, and then put the previous central map-coordinate back to the centre of user's newly resized screen canvas.scale(scaleX,scaleY); var newCentrePixX = Visualize.mGraph.canvas.canvases[0].size.width / 2, newCentrePixY = Visualize.mGraph.canvas.canvases[0].size.height / 2,