Skip to content

Commit

Permalink
Fix Zoom Centre (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
webfiltered authored Nov 28, 2024
1 parent eb54546 commit 2a39b21
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/DragAndScale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ export class DragAndScale {
if (!rect) return

zooming_center = zooming_center || [rect.width * 0.5, rect.height * 0.5]
zooming_center[0] -= rect.x
zooming_center[1] -= rect.y
const center = this.convertCanvasToOffset(zooming_center)
this.scale = value
if (Math.abs(this.scale - 1) < 0.01) this.scale = 1
Expand Down

0 comments on commit 2a39b21

Please sign in to comment.