Skip to content

Commit

Permalink
Fix broken right-click to reset
Browse files Browse the repository at this point in the history
  • Loading branch information
qu1ck committed Apr 16, 2019
1 parent 1b02f10 commit 554cf76
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions InteractiveHtmlBom/web/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 554cf76

Please sign in to comment.