Skip to content

Commit 554cf76

Browse files
committed
Fix broken right-click to reset
1 parent 1b02f10 commit 554cf76

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

InteractiveHtmlBom/web/render.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,13 @@ function handlePointerUp(e, layerdict) {
501501
e.preventDefault();
502502
e.stopPropagation();
503503

504+
if (e.button == 2) {
505+
// Reset pan and zoom on right click.
506+
resetTransform(layerdict);
507+
layerdict.anotherPointerTapped = false;
508+
return;
509+
}
510+
504511
// We haven't necessarily had a pointermove event since the interaction started, so make sure we update this now
505512
var ptr = layerdict.pointerStates[e.pointerId];
506513
ptr.distanceTravelled += Math.abs(e.offsetX - ptr.lastX) + Math.abs(e.offsetY - ptr.lastY);
@@ -519,10 +526,6 @@ function handlePointerUp(e, layerdict) {
519526
// This is the first finger coming off of what could become a two-finger tap
520527
layerdict.anotherPointerTapped = true;
521528
}
522-
} else if (e.button == 2) {
523-
// Reset pan and zoom on right click.
524-
resetTransform(layerdict);
525-
layerdict.anotherPointerTapped = false;
526529
} else {
527530
if (!redrawOnDrag) {
528531
redrawCanvas(layerdict);

0 commit comments

Comments
 (0)