Skip to content

Commit

Permalink
Allow object to move to right edge and bottom edge and allow scroll o…
Browse files Browse the repository at this point in the history
…f 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
  • Loading branch information
krmanik authored Dec 15, 2024
1 parent d900506 commit 65fd461
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ts/routes/image-occlusion/Toolbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions ts/routes/image-occlusion/tools/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 65fd461

Please sign in to comment.