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