From 554cf767df05466cd5d86807a480b1cf8a6dcb82 Mon Sep 17 00:00:00 2001 From: qu1ck Date: Tue, 16 Apr 2019 01:50:25 -0700 Subject: [PATCH] Fix broken right-click to reset --- InteractiveHtmlBom/web/render.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/InteractiveHtmlBom/web/render.js b/InteractiveHtmlBom/web/render.js index 5b9eae3a..30f1d831 100644 --- a/InteractiveHtmlBom/web/render.js +++ b/InteractiveHtmlBom/web/render.js @@ -501,6 +501,13 @@ function handlePointerUp(e, layerdict) { e.preventDefault(); e.stopPropagation(); + if (e.button == 2) { + // Reset pan and zoom on right click. + resetTransform(layerdict); + layerdict.anotherPointerTapped = false; + return; + } + // We haven't necessarily had a pointermove event since the interaction started, so make sure we update this now var ptr = layerdict.pointerStates[e.pointerId]; ptr.distanceTravelled += Math.abs(e.offsetX - ptr.lastX) + Math.abs(e.offsetY - ptr.lastY); @@ -519,10 +526,6 @@ function handlePointerUp(e, layerdict) { // This is the first finger coming off of what could become a two-finger tap layerdict.anotherPointerTapped = true; } - } else if (e.button == 2) { - // Reset pan and zoom on right click. - resetTransform(layerdict); - layerdict.anotherPointerTapped = false; } else { if (!redrawOnDrag) { redrawCanvas(layerdict);