Skip to content

Commit

Permalink
fix: multi img group(#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-zone committed Aug 30, 2024
1 parent fb965ae commit af35a01
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/assets/demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -372,5 +372,5 @@
"hasControls": true
},
"background": "#ddd",
"fabritor_schema_version": 3
"fabritor_schema_version": 3.1
}
1 change: 0 additions & 1 deletion src/editor/custom-objects/FImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const createFImageClass = () => {
_createClipPath () {
const width = this.img.width;
const height = this.img.height;
console.log(width, height)
return new fabric.Rect({
originX: 'center',
originY: 'center',
Expand Down
7 changes: 7 additions & 0 deletions src/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ export const groupSelection = (canvas, target) => {
if (!target || target.type !== 'activeSelection') {
return;
}

canvas.getActiveObjects().forEach((o) => {
if (o.type === 'f-image') {
o.img.clipPath= null;
}
});

target.toGroup();
canvas.requestRenderAll();
canvas.fire('fabritor:group');
Expand Down

0 comments on commit af35a01

Please sign in to comment.