fix ink demo

This commit is contained in:
“chrisshank” 2024-12-03 20:30:14 -08:00
parent 4e2ece8f01
commit 1f1cfcb597
2 changed files with 6 additions and 4 deletions

View File

@ -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';

View File

@ -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);