diff --git a/demos/web-editor/web/src/index.html b/demos/web-editor/web/src/index.html index ee6db76c..e09f9726 100644 --- a/demos/web-editor/web/src/index.html +++ b/demos/web-editor/web/src/index.html @@ -26,6 +26,8 @@ max-height: 512px; outline: 1px solid #bbb; margin-bottom: 12px; + user-select: none; + touch-action: none; } span#status { display: block; diff --git a/demos/web-editor/web/src/index.ts b/demos/web-editor/web/src/index.ts index 9f593bfc..abc39b5b 100644 --- a/demos/web-editor/web/src/index.ts +++ b/demos/web-editor/web/src/index.ts @@ -76,21 +76,36 @@ class App { scene.canvas.addEventListener("contextmenu", (event) => { event.preventDefault(); }); - scene.canvas.addEventListener("mousedown", (event) => { - if (event.button === 0) { - scene.beginTranslate(event); - } else if (event.button === 2) { - scene.beginRotate(event); - } - }); - window.addEventListener("mouseup", (event) => { - scene.endDrag(); - }); - window.addEventListener("mousemove", (event) => { - if (scene.drag(event)) { - requestRedraw(); - } - }); + scene.canvas.addEventListener( + "pointerdown", + (event) => { + event.preventDefault(); + if (event.button === 0) { + scene.beginTranslate(event); + } else if (event.button === 2) { + scene.beginRotate(event); + } + }, + { passive: false }, + ); + window.addEventListener( + "pointerup", + (event) => { + event.preventDefault(); + scene.endDrag(); + }, + { passive: false }, + ); + window.addEventListener( + "pointermove", + (event) => { + event.preventDefault(); + if (scene.drag(event)) { + requestRedraw(); + } + }, + { passive: false }, + ); this.scene = scene; // Hot-patch the gyroid script to be eval (instead of exec) flavored