Persist mask group scaling (#2878)

* Persist mask group scaling

Handles the first issue in #2876

* Fix selection resizing
This commit is contained in:
Abdo 2023-12-10 03:02:47 +03:00 committed by GitHub
parent 97f43fbd45
commit 548aca5b4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -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":

View file

@ -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 => {