@anu3ev/fabric-image-editor 0.9.22 → 0.9.23

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.
Files changed (2) hide show
  1. package/dist/main.js +7 -14
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -16457,22 +16457,14 @@ var gd = {
16457
16457
  }), n || this._rememberSourceBoundFrameIfNeeded({
16458
16458
  session: t,
16459
16459
  event: e
16460
- });
16461
- let r = this._canKeepCurrentResizeMode;
16462
- this._canKeepCurrentResizeMode = pc({ transform: e?.transform });
16463
- try {
16464
- this.editor.canvas.fire("editor:crop:changed", this.getState());
16465
- } finally {
16466
- this._canKeepCurrentResizeMode = r;
16467
- }
16468
- this.editor.canvas.requestRenderAll();
16460
+ }), pc({ transform: e?.transform }) && (this._activeResizePreserveAspectRatio = t.effectivePreserveAspectRatio), this.editor.canvas.fire("editor:crop:changed", this.getState()), this.editor.canvas.requestRenderAll();
16469
16461
  }, this._handleCropFrameModified = (e) => {
16470
16462
  this._handleCropFrameChanged(e);
16471
16463
  let { _session: t } = this;
16472
16464
  t && (qu({
16473
16465
  frame: t.frame,
16474
16466
  preserveAspectRatio: null
16475
- }), t.effectivePreserveAspectRatio = t.options.preserveAspectRatio);
16467
+ }), this._activeResizePreserveAspectRatio = null, t.effectivePreserveAspectRatio = t.options.preserveAspectRatio);
16476
16468
  }, this._handleCanvasSelectionChanged = () => {
16477
16469
  let { _session: e } = this;
16478
16470
  e && e.options.cancelOnSelectionClear && (this._isSpacePanActive() || this.editor.canvas.getActiveObject() !== e.frame && this.cancel());
@@ -16481,7 +16473,7 @@ var gd = {
16481
16473
  if (!t || !t.options.cancelOnSelectionClear || this._isSpacePanActive() || e === t.frame) return;
16482
16474
  let n = null;
16483
16475
  t.mode === "image" && (n = t.target), this._cancelFromPointerDown({ nextActiveObject: n });
16484
- }, this.editor = e, this._session = null, this._canKeepCurrentResizeMode = !1;
16476
+ }, this.editor = e, this._session = null, this._activeResizePreserveAspectRatio = null;
16485
16477
  }
16486
16478
  get isActive() {
16487
16479
  return !!this._session;
@@ -16495,6 +16487,7 @@ var gd = {
16495
16487
  frame: e.frame,
16496
16488
  options: e.options,
16497
16489
  target: e.target,
16490
+ effectivePreserveAspectRatio: e.effectivePreserveAspectRatio,
16498
16491
  rect: td({
16499
16492
  rect: t,
16500
16493
  sourceSize: n
@@ -16600,14 +16593,14 @@ var gd = {
16600
16593
  setPreserveAspectRatio({ preserveAspectRatio: e, keepCurrentResizeMode: t = !1 }) {
16601
16594
  let { _session: n } = this;
16602
16595
  if (!n) return null;
16603
- let r = n.effectivePreserveAspectRatio;
16596
+ let r = this._activeResizePreserveAspectRatio;
16604
16597
  return n.options.preserveAspectRatio = e, this._setFramePreserveAspectRatio({
16605
16598
  frame: n.frame,
16606
16599
  preserveAspectRatio: e
16607
16600
  }), qu({
16608
16601
  frame: n.frame,
16609
16602
  preserveAspectRatio: null
16610
- }), n.effectivePreserveAspectRatio = e, t && this._canKeepCurrentResizeMode && (n.effectivePreserveAspectRatio = r, qu({
16603
+ }), n.effectivePreserveAspectRatio = e, t && r !== null && (n.effectivePreserveAspectRatio = r, qu({
16611
16604
  frame: n.frame,
16612
16605
  preserveAspectRatio: r
16613
16606
  })), this.editor.canvas.requestRenderAll(), this.getState();
@@ -16954,7 +16947,7 @@ var gd = {
16954
16947
  }
16955
16948
  _finishSession({ nextActiveObject: e }) {
16956
16949
  let { _session: t } = this;
16957
- t && (this._unbindCropFrameEvents({ frame: t.frame }), this._unbindCanvasSelectionEvents(), this.editor.canvas.remove(t.frame), this._restoreSceneObjects({ interactivity: t.interactivity }), this.editor.historyManager.resumeHistory(), this._session = null, this._restoreActiveObject({ object: e }), this.editor.toolbar.showAfterTemporary(), this.editor.canvas.requestRenderAll());
16950
+ t && (this._unbindCropFrameEvents({ frame: t.frame }), this._unbindCanvasSelectionEvents(), this.editor.canvas.remove(t.frame), this._restoreSceneObjects({ interactivity: t.interactivity }), this.editor.historyManager.resumeHistory(), this._activeResizePreserveAspectRatio = null, this._session = null, this._restoreActiveObject({ object: e }), this.editor.toolbar.showAfterTemporary(), this.editor.canvas.requestRenderAll());
16958
16951
  }
16959
16952
  _disableSceneObjects() {
16960
16953
  return this.editor.canvasManager.getObjects().map((e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anu3ev/fabric-image-editor",
3
- "version": "0.9.22",
3
+ "version": "0.9.23",
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": [