Skip to content

Commit

Permalink
Fix: replace scale when dragging points
Browse files Browse the repository at this point in the history
  • Loading branch information
alexamy committed Jul 3, 2024
1 parent 42bb41a commit 163067b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/editor/DrawingBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ const Canvas = styled("svg", {

export function DrawingBoard(props: { imageRef: HTMLImageElement }) {
const [store, _, setStore] = useAppStore().editor;
const region = useRegionContext();

function updatePoint(i: number, delta: { dx: number; dy: number }) {
setStore("points", i, (point) => ({
x: point.x + delta.dx,
y: point.y + delta.dy,
x: point.x + delta.dx / region.scale(),
y: point.y + delta.dy / region.scale(),
}));
}

Expand Down

0 comments on commit 163067b

Please sign in to comment.