diff --git a/packages/frontend/src/utility/room/engine.ts b/packages/frontend/src/utility/room/engine.ts index eb80d36cb0..e765d269e5 100644 --- a/packages/frontend/src/utility/room/engine.ts +++ b/packages/frontend/src/utility/room/engine.ts @@ -264,7 +264,28 @@ export class RoomEngine { //postProcess.colorCurves = curve; } + let isDragging = false; + + this.canvas.addEventListener('pointerdown', (ev) => { + this.canvas.setPointerCapture(ev.pointerId); + }); + + this.canvas.addEventListener('pointermove', (ev) => { + if (this.canvas.hasPointerCapture(ev.pointerId)) { + isDragging = true; + } + }); + + this.canvas.addEventListener('pointerup', (ev) => { + window.setTimeout(() => { + isDragging = false; + this.canvas.releasePointerCapture(ev.pointerId); + }, 0); + }); + this.canvas.addEventListener('click', (ev) => { + if (this.grabbing != null) return; + if (isDragging) return; const mesh = this.scene.pick(this.scene.pointerX, this.scene.pointerY)?.pickedMesh; if (mesh != null) { const oid = mesh.metadata.objectId;