@anu3ev/fabric-image-editor 0.9.20 → 0.9.21
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 +14 -10
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -16412,16 +16412,14 @@ var dd = {
|
|
|
16412
16412
|
this._handleCropFrameChanged = (e) => {
|
|
16413
16413
|
let { _session: t } = this;
|
|
16414
16414
|
if (!t) return;
|
|
16415
|
+
t.effectivePreserveAspectRatio = this._getEffectivePreserveAspectRatio(e);
|
|
16415
16416
|
let n = this._restoreSourceBoundFrameIfNeeded({
|
|
16416
16417
|
session: t,
|
|
16417
16418
|
event: e
|
|
16418
16419
|
});
|
|
16419
16420
|
this._clampFrameIfNeeded({
|
|
16420
16421
|
session: t,
|
|
16421
|
-
preserveAspectRatio:
|
|
16422
|
-
session: t,
|
|
16423
|
-
event: e
|
|
16424
|
-
})
|
|
16422
|
+
preserveAspectRatio: t.effectivePreserveAspectRatio
|
|
16425
16423
|
}), this._restoreFrameScaleAnchorFromEventIfNeeded({
|
|
16426
16424
|
session: t,
|
|
16427
16425
|
event: e
|
|
@@ -16457,6 +16455,13 @@ var dd = {
|
|
|
16457
16455
|
})
|
|
16458
16456
|
};
|
|
16459
16457
|
}
|
|
16458
|
+
get effectivePreserveAspectRatio() {
|
|
16459
|
+
return this._session?.effectivePreserveAspectRatio ?? !0;
|
|
16460
|
+
}
|
|
16461
|
+
_getEffectivePreserveAspectRatio(e) {
|
|
16462
|
+
let { _session: t } = this;
|
|
16463
|
+
return t ? this._isSourceScaleClamped({ event: e }) ? e?.transform?.cropSourceScalePreserveAspectRatio ?? !0 : e?.e?.shiftKey ? !t.options.preserveAspectRatio : t.options.preserveAspectRatio : !0;
|
|
16464
|
+
}
|
|
16460
16465
|
isFrameOverflowingSource({ target: e }) {
|
|
16461
16466
|
let { _session: t } = this;
|
|
16462
16467
|
if (!t || !e || t.options.allowFrameOverflow || t.frame !== e) return !1;
|
|
@@ -16545,7 +16550,7 @@ var dd = {
|
|
|
16545
16550
|
}
|
|
16546
16551
|
setPreserveAspectRatio({ preserveAspectRatio: e }) {
|
|
16547
16552
|
let { _session: t } = this;
|
|
16548
|
-
return t ? (t.options.preserveAspectRatio = e, this._setFramePreserveAspectRatio({
|
|
16553
|
+
return t ? (t.options.preserveAspectRatio = e, t.effectivePreserveAspectRatio = e, this._setFramePreserveAspectRatio({
|
|
16549
16554
|
frame: t.frame,
|
|
16550
16555
|
preserveAspectRatio: e
|
|
16551
16556
|
}), this.editor.canvas.requestRenderAll(), this.getState()) : null;
|
|
@@ -16589,7 +16594,8 @@ var dd = {
|
|
|
16589
16594
|
options: n,
|
|
16590
16595
|
previousActiveObject: this.editor.canvas.getActiveObject() ?? null,
|
|
16591
16596
|
interactivity: [],
|
|
16592
|
-
sourceBoundFrameState: null
|
|
16597
|
+
sourceBoundFrameState: null,
|
|
16598
|
+
effectivePreserveAspectRatio: n.preserveAspectRatio
|
|
16593
16599
|
};
|
|
16594
16600
|
}
|
|
16595
16601
|
_createImageSession({ target: e, options: t }) {
|
|
@@ -16606,7 +16612,8 @@ var dd = {
|
|
|
16606
16612
|
options: n,
|
|
16607
16613
|
previousActiveObject: this.editor.canvas.getActiveObject() ?? null,
|
|
16608
16614
|
interactivity: [],
|
|
16609
|
-
sourceBoundFrameState: null
|
|
16615
|
+
sourceBoundFrameState: null,
|
|
16616
|
+
effectivePreserveAspectRatio: n.preserveAspectRatio
|
|
16610
16617
|
};
|
|
16611
16618
|
}
|
|
16612
16619
|
_resolveSessionOptions({ options: e }) {
|
|
@@ -16804,9 +16811,6 @@ var dd = {
|
|
|
16804
16811
|
_getTransformAnchorY({ transform: e }) {
|
|
16805
16812
|
return e.corner === "tl" || e.corner === "tr" || e.corner === "mt" ? "max" : e.corner === "bl" || e.corner === "br" || e.corner === "mb" || e.originY === "top" || e.originY === 0 ? "min" : e.originY === "bottom" || e.originY === 1 ? "max" : "center";
|
|
16806
16813
|
}
|
|
16807
|
-
_shouldPreserveAspectRatioOnFrameClamp({ session: e, event: t }) {
|
|
16808
|
-
return this._isSourceScaleClamped({ event: t }) ? t?.transform?.cropSourceScalePreserveAspectRatio ?? !0 : t?.e?.shiftKey ? !e.options.preserveAspectRatio : e.options.preserveAspectRatio;
|
|
16809
|
-
}
|
|
16810
16814
|
_getFrameTransformState({ session: e }) {
|
|
16811
16815
|
return {
|
|
16812
16816
|
left: e.frame.left,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anu3ev/fabric-image-editor",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.21",
|
|
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": [
|