@anu3ev/fabric-image-editor 0.9.11 → 0.9.12

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 +9 -1
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -3955,6 +3955,14 @@ var $t = class {
3955
3955
  }
3956
3956
  return !1;
3957
3957
  }
3958
+ _constrainViewportToPanBounds() {
3959
+ let { canvas: e, montageArea: t, panConstraintManager: n } = this.editor, r = e.viewportTransform;
3960
+ n.updateBounds();
3961
+ let i = n.constrainPan(r[4], r[5]);
3962
+ if (!(i.x !== r[4] || i.y !== r[5])) return;
3963
+ let a = [...r];
3964
+ a[4] = i.x, a[5] = i.y, e.setViewportTransform(a), t.setCoords();
3965
+ }
3958
3966
  updateDefaultZoom(e = this.options.defaultScale) {
3959
3967
  return this.defaultZoom = this._calculateDefaultZoom(e), this.defaultZoom;
3960
3968
  }
@@ -3998,7 +4006,7 @@ var $t = class {
3998
4006
  let { minZoom: n, maxZoom: r } = this, { canvas: i } = this.editor, a = e < 0, o = i.getZoom(), s = i.getCenterPoint(), c = new m(t.pointX ?? s.x, t.pointY ?? s.y);
3999
4007
  this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
4000
4008
  let l = o + Number(e);
4001
- l > r && (l = r), l < n && (l = n), i.zoomToPoint(c, l), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(l, a, e), i.fire("editor:zoom-changed", {
4009
+ l > r && (l = r), l < n && (l = n), i.zoomToPoint(c, l), this._applyViewportCentering(l, a, e), this._constrainViewportToPanBounds(), i.fire("editor:zoom-changed", {
4002
4010
  currentZoom: i.getZoom(),
4003
4011
  zoom: l,
4004
4012
  point: c
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anu3ev/fabric-image-editor",
3
- "version": "0.9.11",
3
+ "version": "0.9.12",
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": [