@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.mjs CHANGED
@@ -354,7 +354,7 @@ class Cache {
354
354
  }
355
355
  const cache = new Cache();
356
356
 
357
- var version = "7.0.1-beta5";
357
+ var version = "7.0.1-beta6";
358
358
 
359
359
  // use this syntax so babel plugin see this import here
360
360
  const VERSION = version;
@@ -17697,16 +17697,18 @@ class Line extends FabricObject {
17697
17697
  }
17698
17698
  setCoords() {
17699
17699
  if (this._useEndpointCoords) {
17700
- // Set the object's center to the geometric center of the line
17701
- const center = this._findCenterFromElement();
17702
- this.left = center.x;
17703
- this.top = center.y;
17704
-
17705
17700
  // Set width and height for hit detection and bounding box
17706
17701
  const effectiveStrokeWidth = this.hitStrokeWidth === 'auto' ? this.strokeWidth : this.hitStrokeWidth;
17707
17702
  const hitPadding = Math.max(effectiveStrokeWidth / 2 + 5, 10);
17708
17703
  this.width = Math.abs(this.x2 - this.x1) + hitPadding * 2;
17709
17704
  this.height = Math.abs(this.y2 - this.y1) + hitPadding * 2;
17705
+
17706
+ // Only update left/top if they haven't been explicitly set (e.g., during loading)
17707
+ if (this.left === 0 && this.top === 0) {
17708
+ const center = this._findCenterFromElement();
17709
+ this.left = center.x;
17710
+ this.top = center.y;
17711
+ }
17710
17712
  }
17711
17713
  super.setCoords();
17712
17714
  }
@@ -17914,6 +17916,15 @@ class Line extends FabricObject {
17914
17916
  }
17915
17917
  toObject() {
17916
17918
  let propertiesToInclude = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17919
+ if (this._useEndpointCoords) {
17920
+ return {
17921
+ ...super.toObject(propertiesToInclude),
17922
+ x1: this.x1,
17923
+ y1: this.y1,
17924
+ x2: this.x2,
17925
+ y2: this.y2
17926
+ };
17927
+ }
17917
17928
  return {
17918
17929
  ...super.toObject(propertiesToInclude),
17919
17930
  ...this.calcLinePoints()