Skip to content

Commit

Permalink
fix ink demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisShank committed Dec 4, 2024
1 parent 4e2ece8 commit 1f1cfcb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions demo/html-ink.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
position: relative;
margin: 0;
}

button {
margin: 0.5rem;
}
</style>
</head>
<body>
<nav>
<button on:click="DRAW">Draw</button>
</nav>
<button on:click="DRAW">Draw</button>
<script type="module">
import '../src/standalone/folk-shape.ts';
import '../src/standalone/folk-ink.ts';
Expand Down
2 changes: 1 addition & 1 deletion src/folk-ink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ export class FolkInk extends HTMLElement {

handleEvent(event: PointerEvent) {
switch (event.type) {
// for some reason adding a point on pointer down causes a bug
case 'pointerdown': {
if (event.button !== 0 || event.ctrlKey) return;

this.points = [];
this.addPoint([event.offsetX, event.offsetY, event.pressure]);
this.addEventListener('lostpointercapture', this);
this.addEventListener('pointermove', this);
this.setPointerCapture(event.pointerId);
Expand Down

0 comments on commit 1f1cfcb

Please sign in to comment.