mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
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:
parent
d900506003
commit
65fd461ddc
2 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue