@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 +17 -6
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +17 -6
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +17 -6
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +17 -6
- package/dist/index.node.mjs.map +1 -1
- package/dist/package.json.min.mjs +1 -1
- package/dist/package.json.mjs +1 -1
- package/dist/src/shapes/Line.d.ts.map +1 -1
- package/dist/src/shapes/Line.min.mjs +1 -1
- package/dist/src/shapes/Line.min.mjs.map +1 -1
- package/dist/src/shapes/Line.mjs +16 -5
- package/dist/src/shapes/Line.mjs.map +1 -1
- package/dist-extensions/src/shapes/Line.d.ts.map +1 -1
- package/fabric-test2.html +91 -0
- package/package.json +1 -1
- package/src/shapes/Line.ts +16 -5
package/dist/index.node.mjs
CHANGED
|
@@ -410,7 +410,7 @@ class Cache {
|
|
|
410
410
|
}
|
|
411
411
|
const cache = new Cache();
|
|
412
412
|
|
|
413
|
-
var version = "7.0.1-
|
|
413
|
+
var version = "7.0.1-beta6";
|
|
414
414
|
|
|
415
415
|
// use this syntax so babel plugin see this import here
|
|
416
416
|
const VERSION = version;
|
|
@@ -17753,16 +17753,18 @@ class Line extends FabricObject {
|
|
|
17753
17753
|
}
|
|
17754
17754
|
setCoords() {
|
|
17755
17755
|
if (this._useEndpointCoords) {
|
|
17756
|
-
// Set the object's center to the geometric center of the line
|
|
17757
|
-
const center = this._findCenterFromElement();
|
|
17758
|
-
this.left = center.x;
|
|
17759
|
-
this.top = center.y;
|
|
17760
|
-
|
|
17761
17756
|
// Set width and height for hit detection and bounding box
|
|
17762
17757
|
const effectiveStrokeWidth = this.hitStrokeWidth === 'auto' ? this.strokeWidth : this.hitStrokeWidth;
|
|
17763
17758
|
const hitPadding = Math.max(effectiveStrokeWidth / 2 + 5, 10);
|
|
17764
17759
|
this.width = Math.abs(this.x2 - this.x1) + hitPadding * 2;
|
|
17765
17760
|
this.height = Math.abs(this.y2 - this.y1) + hitPadding * 2;
|
|
17761
|
+
|
|
17762
|
+
// Only update left/top if they haven't been explicitly set (e.g., during loading)
|
|
17763
|
+
if (this.left === 0 && this.top === 0) {
|
|
17764
|
+
const center = this._findCenterFromElement();
|
|
17765
|
+
this.left = center.x;
|
|
17766
|
+
this.top = center.y;
|
|
17767
|
+
}
|
|
17766
17768
|
}
|
|
17767
17769
|
super.setCoords();
|
|
17768
17770
|
}
|
|
@@ -17970,6 +17972,15 @@ class Line extends FabricObject {
|
|
|
17970
17972
|
}
|
|
17971
17973
|
toObject() {
|
|
17972
17974
|
let propertiesToInclude = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
17975
|
+
if (this._useEndpointCoords) {
|
|
17976
|
+
return {
|
|
17977
|
+
...super.toObject(propertiesToInclude),
|
|
17978
|
+
x1: this.x1,
|
|
17979
|
+
y1: this.y1,
|
|
17980
|
+
x2: this.x2,
|
|
17981
|
+
y2: this.y2
|
|
17982
|
+
};
|
|
17983
|
+
}
|
|
17973
17984
|
return {
|
|
17974
17985
|
...super.toObject(propertiesToInclude),
|
|
17975
17986
|
...this.calcLinePoints()
|