Skip to content

Commit

Permalink
Fixed visual bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
daswer123 committed Jun 4, 2023
1 parent 1a49178 commit ad3d6d9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,13 +622,14 @@ onUiLoaded(async() => {
panSpeed = 3.5;
}

elemData[elemId].panX =
elemData[elemId].panX + movementX * panSpeed;
elemData[elemId].panY =
elemData[elemId].panY + movementY * panSpeed;
elemData[elemId].panX += movementX * panSpeed;
elemData[elemId].panY += movementY * panSpeed;

targetElement.style.transform = `translate(${elemData[elemId].panX}px, ${elemData[elemId].panY}px) scale(${elemData[elemId].zoomLevel})`;
toggleOverlap("on");
// Delayed redraw of an element
requestAnimationFrame(() => {
targetElement.style.transform = `translate(${elemData[elemId].panX}px, ${elemData[elemId].panY}px) scale(${elemData[elemId].zoomLevel})`;
toggleOverlap("on");
});
}

function handleMoveByKey(e) {
Expand Down

0 comments on commit ad3d6d9

Please sign in to comment.