From e30d05f71d87bdc9f1c7752f56eba78974ef6c97 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 18 Dec 2016 16:14:39 -0500 Subject: [PATCH] fix initial scale/translate algorithm --- frontend/src/Metamaps/Visualize.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/Metamaps/Visualize.js b/frontend/src/Metamaps/Visualize.js index 6aafb697..1ae73da2 100644 --- a/frontend/src/Metamaps/Visualize.js +++ b/frontend/src/Metamaps/Visualize.js @@ -173,13 +173,13 @@ const Visualize = { } const queryParams = Util.queryParams() - if (typeof queryParams.scale === 'string') { - const scale = parseFloat(queryParams.scale) || 0 - self.mGraph.canvas.scale(scale, scale) - } + const scale = parseFloat(queryParams.scale) || 1.0 if (typeof queryParams.translate === 'string') { const [x, y] = queryParams.translate.split(',').map(n => parseFloat(n) || 0) - self.mGraph.canvas.translate(x, y) + self.mGraph.canvas.translate(x / scale, y / scale) + } + if (typeof queryParams.scale === 'string') { + self.mGraph.canvas.scale(scale, scale) } function runAnimation() {