From 65fd461ddc47045a49d1924226b9295675f9dbf0 Mon Sep 17 00:00:00 2001 From: Mani <12841290+krmanik@users.noreply.github.com> Date: Mon, 16 Dec 2024 00:30:47 +0800 Subject: [PATCH] Allow object to move to right edge and bottom edge and allow scroll of note fields when not using IO (#3630) * allow drag and draw at right and bottom edge of canvas area * allow scroll in fields, when mask editor hidden * format code --- ts/routes/image-occlusion/Toolbar.svelte | 5 +++++ ts/routes/image-occlusion/tools/lib.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ts/routes/image-occlusion/Toolbar.svelte b/ts/routes/image-occlusion/Toolbar.svelte index 3031494a8..d9d854820 100644 --- a/ts/routes/image-occlusion/Toolbar.svelte +++ b/ts/routes/image-occlusion/Toolbar.svelte @@ -125,6 +125,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } function onWheel(event: WheelEvent) { + // allow scroll in fields, when mask editor hidden + if (!$ioMaskEditorVisible) { + return; + } + if (event.ctrlKey) { controlClicked = true; } diff --git a/ts/routes/image-occlusion/tools/lib.ts b/ts/routes/image-occlusion/tools/lib.ts index 3709add6a..d00de6326 100644 --- a/ts/routes/image-occlusion/tools/lib.ts +++ b/ts/routes/image-occlusion/tools/lib.ts @@ -288,9 +288,9 @@ export const makeShapesRemainInCanvas = (canvas: fabric.Canvas, boundingBox: fab const left = obj.left!; const topBound = boundingBox.top!; - const bottomBound = topBound + boundingBox.height!; + const bottomBound = topBound + boundingBox.height! + 5; const leftBound = boundingBox.left!; - const rightBound = leftBound + boundingBox.width!; + const rightBound = leftBound + boundingBox.width! + 5; obj.left = Math.min(Math.max(left, leftBound), rightBound - objWidth); obj.top = Math.min(Math.max(top, topBound), bottomBound - objHeight);