From cda1946c291ab8dfc689f24badc3f3d37356cc87 Mon Sep 17 00:00:00 2001 From: Bill Date: Sat, 16 Oct 2021 15:08:47 -0400 Subject: [PATCH] Update setRoomInstanceRenderingCanvasOffset --- src/nitro/room/RoomEngine.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/nitro/room/RoomEngine.ts b/src/nitro/room/RoomEngine.ts index cbc50fd4..419e674b 100644 --- a/src/nitro/room/RoomEngine.ts +++ b/src/nitro/room/RoomEngine.ts @@ -666,10 +666,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(!renderingCanvas || !point) return false; - this.events.dispatchEvent(new RoomDragEvent(roomId, -(renderingCanvas.screenOffsetX - point.x), -(renderingCanvas.screenOffsetY - point.y))); + const x = ~~(point.x); + const y = ~~(point.y); - renderingCanvas.screenOffsetX = point.x; - renderingCanvas.screenOffsetY = point.y; + if((renderingCanvas.screenOffsetX === x) && (renderingCanvas.screenOffsetY === y)) return; + + this.events.dispatchEvent(new RoomDragEvent(roomId, -(renderingCanvas.screenOffsetX - x), -(renderingCanvas.screenOffsetY - y))); + + renderingCanvas.screenOffsetX = x; + renderingCanvas.screenOffsetY = y; return true; } @@ -1187,7 +1192,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } } - if(this._activeRoomIsDragged) + if(this._activeRoomWasDragged) { const renderingCanvas = this.getRoomInstanceRenderingCanvas(this._activeRoomId, 1);