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
This commit is contained in:
Mani 2024-12-16 00:30:47 +08:00 committed by GitHub
parent d900506003
commit 65fd461ddc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -125,6 +125,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
} }
function onWheel(event: WheelEvent) { function onWheel(event: WheelEvent) {
// allow scroll in fields, when mask editor hidden
if (!$ioMaskEditorVisible) {
return;
}
if (event.ctrlKey) { if (event.ctrlKey) {
controlClicked = true; controlClicked = true;
} }

View file

@ -288,9 +288,9 @@ export const makeShapesRemainInCanvas = (canvas: fabric.Canvas, boundingBox: fab
const left = obj.left!; const left = obj.left!;
const topBound = boundingBox.top!; const topBound = boundingBox.top!;
const bottomBound = topBound + boundingBox.height!; const bottomBound = topBound + boundingBox.height! + 5;
const leftBound = boundingBox.left!; 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.left = Math.min(Math.max(left, leftBound), rightBound - objWidth);
obj.top = Math.min(Math.max(top, topBound), bottomBound - objHeight); obj.top = Math.min(Math.max(top, topBound), bottomBound - objHeight);