mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -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
|
// Prevents the original fabric object from mutating when a non-primitive
|
||||||
// property of a Shape mutates.
|
// property of a Shape mutates.
|
||||||
const cloned = cloneDeep(object);
|
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) {
|
switch (object.type) {
|
||||||
case "rect":
|
case "rect":
|
||||||
|
|
|
@ -189,11 +189,8 @@ export const moveShapeToCanvasBoundaries = (canvas: fabric.Canvas): void => {
|
||||||
if (!activeObject) {
|
if (!activeObject) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (activeObject.type === "rect") {
|
||||||
activeObject.type === "activeSelection"
|
modifiedRectangle(canvas, activeObject);
|
||||||
|| activeObject.type === "rect"
|
|
||||||
) {
|
|
||||||
modifiedSelection(canvas, activeObject);
|
|
||||||
}
|
}
|
||||||
if (activeObject.type === "ellipse") {
|
if (activeObject.type === "ellipse") {
|
||||||
modifiedEllipse(canvas, activeObject);
|
modifiedEllipse(canvas, activeObject);
|
||||||
|
@ -204,7 +201,7 @@ export const moveShapeToCanvasBoundaries = (canvas: fabric.Canvas): void => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const modifiedSelection = (
|
const modifiedRectangle = (
|
||||||
canvas: fabric.Canvas,
|
canvas: fabric.Canvas,
|
||||||
object: fabric.Object,
|
object: fabric.Object,
|
||||||
): void => {
|
): void => {
|
||||||
|
|
Loading…
Reference in a new issue