mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Persist mask group scaling (#2878)
* Persist mask group scaling Handles the first issue in #2876 * Fix selection resizing
This commit is contained in:
parent
97f43fbd45
commit
548aca5b4f
2 changed files with 8 additions and 6 deletions
|
@ -68,6 +68,11 @@ function fabricObjectToBaseShapeOrShapes(
|
|||
// Prevents the original fabric object from mutating when a non-primitive
|
||||
// property of a Shape mutates.
|
||||
const cloned = cloneDeep(object);
|
||||
if (parentObject) {
|
||||
const scaling = parentObject.getObjectScaling();
|
||||
cloned.width = cloned.width * scaling.scaleX;
|
||||
cloned.height = cloned.height * scaling.scaleY;
|
||||
}
|
||||
|
||||
switch (object.type) {
|
||||
case "rect":
|
||||
|
|
|
@ -189,11 +189,8 @@ export const moveShapeToCanvasBoundaries = (canvas: fabric.Canvas): void => {
|
|||
if (!activeObject) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
activeObject.type === "activeSelection"
|
||||
|| activeObject.type === "rect"
|
||||
) {
|
||||
modifiedSelection(canvas, activeObject);
|
||||
if (activeObject.type === "rect") {
|
||||
modifiedRectangle(canvas, activeObject);
|
||||
}
|
||||
if (activeObject.type === "ellipse") {
|
||||
modifiedEllipse(canvas, activeObject);
|
||||
|
@ -204,7 +201,7 @@ export const moveShapeToCanvasBoundaries = (canvas: fabric.Canvas): void => {
|
|||
});
|
||||
};
|
||||
|
||||
const modifiedSelection = (
|
||||
const modifiedRectangle = (
|
||||
canvas: fabric.Canvas,
|
||||
object: fabric.Object,
|
||||
): void => {
|
||||
|
|
Loading…
Reference in a new issue