Update setRoomInstanceRenderingCanvasOffset

This commit is contained in:
Bill 2021-10-16 15:08:47 -04:00
parent d7d49e5974
commit cda1946c29

View File

@ -666,10 +666,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
if(!renderingCanvas || !point) return false; 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; if((renderingCanvas.screenOffsetX === x) && (renderingCanvas.screenOffsetY === y)) return;
renderingCanvas.screenOffsetY = point.y;
this.events.dispatchEvent(new RoomDragEvent(roomId, -(renderingCanvas.screenOffsetX - x), -(renderingCanvas.screenOffsetY - y)));
renderingCanvas.screenOffsetX = x;
renderingCanvas.screenOffsetY = y;
return true; 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); const renderingCanvas = this.getRoomInstanceRenderingCanvas(this._activeRoomId, 1);