Skip to content

Commit

Permalink
frontend(ViewPort): update cursor position outside of canvas too, att…
Browse files Browse the repository at this point in the history
…empt fix tablet pen jumping issue
  • Loading branch information
JackDotJS committed Jul 29, 2024
1 parent 22d39f6 commit 703a004
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/renderer/src/components/viewport/ViewPort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,17 @@ const ViewPort = (): JSXElement => {
updateCursor(ev);
});

window.addEventListener(`pointermove`, (ev) => {
updateCursor(ev);
});

window.addEventListener(`pointerup`, () => {
setDrawing(false);
});

window.addEventListener(`pointerout`, (ev: PointerEvent) => {
if (ev.pointerType === `pen`) setDrawing(false);
});
});

return (
Expand Down Expand Up @@ -112,8 +120,7 @@ const ViewPort = (): JSXElement => {
</label>
</div>
<div
class={style.canvasWrapper}
onPointerMove={(ev) => updateCursor(ev)}
class={style.canvasWrapper}
onPointerEnter={() => setCursorVisible(true)}
onPointerLeave={() => setCursorVisible(false)}
ref={canvasWrapperElem}
Expand Down

0 comments on commit 703a004

Please sign in to comment.