@anu3ev/fabric-image-editor 0.8.10 → 0.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +21 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -3322,7 +3322,7 @@ var Nt = class {
|
|
|
3322
3322
|
});
|
|
3323
3323
|
let r = new e(t, { canvas: a });
|
|
3324
3324
|
a.setActiveObject(r);
|
|
3325
|
-
} else this._fitSingleObject(s, n);
|
|
3325
|
+
} else this._fitSingleObject(s, n), s instanceof e && i && this._materializeFittedSelection({ selection: s });
|
|
3326
3326
|
a.renderAll(), r || o.saveState(), a.fire("editor:object-fitted", {
|
|
3327
3327
|
object: s,
|
|
3328
3328
|
type: n,
|
|
@@ -3336,7 +3336,26 @@ var Nt = class {
|
|
|
3336
3336
|
v = t === "contain" ? Math.min(g / m, _ / h) : Math.max(g / m, _ / h), e.set({
|
|
3337
3337
|
scaleX: o * v,
|
|
3338
3338
|
scaleY: s * v
|
|
3339
|
-
}), n.centerObjectToMontageArea({ object: e });
|
|
3339
|
+
}), n.centerObjectToMontageArea({ object: e }), this._materializeFittedObject({ object: e }) || e.setCoords?.();
|
|
3340
|
+
}
|
|
3341
|
+
_materializeFittedObject({ object: e }) {
|
|
3342
|
+
let { shapeManager: t, textManager: n } = this.editor, r = { target: e };
|
|
3343
|
+
e.shapeComposite === !0 && (r.textScale = Math.abs(e.scaleX ?? 1) || 1);
|
|
3344
|
+
let i = n.commitStandaloneTextScale({ target: e }), a = t.commitRehydratedShapeLayout(r);
|
|
3345
|
+
return i || a;
|
|
3346
|
+
}
|
|
3347
|
+
_requiresFittedObjectMaterialization({ object: e }) {
|
|
3348
|
+
let t = e.type === "textbox" || e.type === "background-textbox", n = "shapeComposite" in e && e.shapeComposite === !0;
|
|
3349
|
+
return t || n;
|
|
3350
|
+
}
|
|
3351
|
+
_materializeFittedSelection({ selection: t }) {
|
|
3352
|
+
let { canvas: n } = this.editor, r = t.getObjects();
|
|
3353
|
+
if (!r.some((e) => this._requiresFittedObjectMaterialization({ object: e }))) return;
|
|
3354
|
+
n.discardActiveObject(), r.forEach((e) => {
|
|
3355
|
+
this._materializeFittedObject({ object: e }) || e.setCoords?.();
|
|
3356
|
+
});
|
|
3357
|
+
let i = new e(r, { canvas: n });
|
|
3358
|
+
n.setActiveObject(i);
|
|
3340
3359
|
}
|
|
3341
3360
|
resetObjects() {
|
|
3342
3361
|
this.editor.canvasManager.getObjects().forEach((e) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anu3ev/fabric-image-editor",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.11",
|
|
4
4
|
"description": "TypeScript image editor library built on FabricJS, allowing you to create instances with an integrated montage area and providing an API to modify and manage state.",
|
|
5
5
|
"module": "dist/main.js",
|
|
6
6
|
"files": [
|