@nasser-sw/fabric 7.0.1-beta6 → 7.0.1-beta7

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/index.js CHANGED
@@ -360,7 +360,7 @@
360
360
  }
361
361
  const cache = new Cache();
362
362
 
363
- var version = "7.0.1-beta5";
363
+ var version = "7.0.1-beta6";
364
364
 
365
365
  // use this syntax so babel plugin see this import here
366
366
  const VERSION = version;
@@ -17703,16 +17703,18 @@
17703
17703
  }
17704
17704
  setCoords() {
17705
17705
  if (this._useEndpointCoords) {
17706
- // Set the object's center to the geometric center of the line
17707
- const center = this._findCenterFromElement();
17708
- this.left = center.x;
17709
- this.top = center.y;
17710
-
17711
17706
  // Set width and height for hit detection and bounding box
17712
17707
  const effectiveStrokeWidth = this.hitStrokeWidth === 'auto' ? this.strokeWidth : this.hitStrokeWidth;
17713
17708
  const hitPadding = Math.max(effectiveStrokeWidth / 2 + 5, 10);
17714
17709
  this.width = Math.abs(this.x2 - this.x1) + hitPadding * 2;
17715
17710
  this.height = Math.abs(this.y2 - this.y1) + hitPadding * 2;
17711
+
17712
+ // Only update left/top if they haven't been explicitly set (e.g., during loading)
17713
+ if (this.left === 0 && this.top === 0) {
17714
+ const center = this._findCenterFromElement();
17715
+ this.left = center.x;
17716
+ this.top = center.y;
17717
+ }
17716
17718
  }
17717
17719
  super.setCoords();
17718
17720
  }
@@ -17920,6 +17922,15 @@
17920
17922
  }
17921
17923
  toObject() {
17922
17924
  let propertiesToInclude = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17925
+ if (this._useEndpointCoords) {
17926
+ return {
17927
+ ...super.toObject(propertiesToInclude),
17928
+ x1: this.x1,
17929
+ y1: this.y1,
17930
+ x2: this.x2,
17931
+ y2: this.y2
17932
+ };
17933
+ }
17923
17934
  return {
17924
17935
  ...super.toObject(propertiesToInclude),
17925
17936
  ...this.calcLinePoints()