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..e5430524 100644 --- a/demos/web-editor/web/src/index.ts +++ b/demos/web-editor/web/src/index.ts @@ -76,21 +76,24 @@ class App { scene.canvas.addEventListener("contextmenu", (event) => { event.preventDefault(); }); - scene.canvas.addEventListener("mousedown", (event) => { + scene.canvas.addEventListener("pointerdown", (event) => { + event.preventDefault(); if (event.button === 0) { scene.beginTranslate(event); } else if (event.button === 2) { scene.beginRotate(event); } - }); - window.addEventListener("mouseup", (event) => { + }, { passive: false }); + window.addEventListener("pointerup", (event) => { + event.preventDefault(); scene.endDrag(); - }); - window.addEventListener("mousemove", (event) => { + }, { 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