From 29abb568ae80f9fc57441aba5f2fa5653a140453 Mon Sep 17 00:00:00 2001 From: dank074 Date: Thu, 20 Jul 2023 20:57:46 -0500 Subject: [PATCH] prevent scrolling canvas on mobile (#156) --- src/components/floorplan-editor/common/FloorplanEditor.ts | 2 ++ src/components/floorplan-editor/views/FloorplanCanvasView.tsx | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/floorplan-editor/common/FloorplanEditor.ts b/src/components/floorplan-editor/common/FloorplanEditor.ts index 7e92800b..f81c38f8 100644 --- a/src/components/floorplan-editor/common/FloorplanEditor.ts +++ b/src/components/floorplan-editor/common/FloorplanEditor.ts @@ -33,6 +33,8 @@ export class FloorplanEditor canvas.height = height; canvas.width = width; + canvas.style.touchAction = 'none'; + this._renderer = canvas.getContext('2d'); this._image = new Image(); diff --git a/src/components/floorplan-editor/views/FloorplanCanvasView.tsx b/src/components/floorplan-editor/views/FloorplanCanvasView.tsx index 8b9b8102..3a2a25f3 100644 --- a/src/components/floorplan-editor/views/FloorplanCanvasView.tsx +++ b/src/components/floorplan-editor/views/FloorplanCanvasView.tsx @@ -138,8 +138,7 @@ export const FloorplanCanvasView: FC = props => const currentElement = elementRef.current; if(!currentElement) return; - - + currentElement.appendChild(FloorplanEditor.instance.renderer.canvas); currentElement.addEventListener('pointerup', onPointerEvent);