@nasser-sw/fabric 7.0.1-beta4 → 7.0.1-beta5
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 +29 -14
- 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 +29 -14
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +29 -14
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +29 -14
- 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 +1 -0
- 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 +28 -13
- package/dist/src/shapes/Line.mjs.map +1 -1
- package/dist-extensions/src/shapes/Line.d.ts +1 -0
- package/dist-extensions/src/shapes/Line.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shapes/Line.ts +31 -12
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-beta5";
|
|
414
414
|
|
|
415
415
|
// use this syntax so babel plugin see this import here
|
|
416
416
|
const VERSION = version;
|
|
@@ -17757,14 +17757,14 @@ class Line extends FabricObject {
|
|
|
17757
17757
|
}
|
|
17758
17758
|
setCoords() {
|
|
17759
17759
|
if (this._useEndpointCoords) {
|
|
17760
|
-
|
|
17761
|
-
const
|
|
17762
|
-
|
|
17763
|
-
|
|
17760
|
+
// Set the object's center to the geometric center of the line
|
|
17761
|
+
const center = this._findCenterFromElement();
|
|
17762
|
+
this.left = center.x;
|
|
17763
|
+
this.top = center.y;
|
|
17764
|
+
|
|
17765
|
+
// Set width and height for hit detection and bounding box
|
|
17764
17766
|
const effectiveStrokeWidth = this.hitStrokeWidth === 'auto' ? this.strokeWidth : this.hitStrokeWidth;
|
|
17765
17767
|
const hitPadding = Math.max(effectiveStrokeWidth / 2 + 5, 10);
|
|
17766
|
-
this.left = minX - hitPadding + (maxX - minX + hitPadding * 2) / 2;
|
|
17767
|
-
this.top = minY - hitPadding + (maxY - minY + hitPadding * 2) / 2;
|
|
17768
17768
|
this.width = Math.abs(this.x2 - this.x1) + hitPadding * 2;
|
|
17769
17769
|
this.height = Math.abs(this.y2 - this.y1) + hitPadding * 2;
|
|
17770
17770
|
}
|
|
@@ -18018,13 +18018,28 @@ class Line extends FabricObject {
|
|
|
18018
18018
|
};
|
|
18019
18019
|
}
|
|
18020
18020
|
_toSVG() {
|
|
18021
|
-
|
|
18022
|
-
|
|
18023
|
-
x2
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
|
|
18021
|
+
if (this._useEndpointCoords) {
|
|
18022
|
+
// Use absolute coordinates to bypass all Fabric.js transforms
|
|
18023
|
+
return [`<line stroke="${this.stroke}" stroke-width="${this.strokeWidth}" stroke-linecap="${this.strokeLineCap}" `, `x1="${this.x1}" y1="${this.y1}" x2="${this.x2}" y2="${this.y2}" />\n`];
|
|
18024
|
+
} else {
|
|
18025
|
+
// Use standard calcLinePoints for legacy mode
|
|
18026
|
+
const {
|
|
18027
|
+
x1,
|
|
18028
|
+
x2,
|
|
18029
|
+
y1,
|
|
18030
|
+
y2
|
|
18031
|
+
} = this.calcLinePoints();
|
|
18032
|
+
return ['<line ', 'COMMON_PARTS', `x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" />\n`];
|
|
18033
|
+
}
|
|
18034
|
+
}
|
|
18035
|
+
toSVG(reviver) {
|
|
18036
|
+
if (this._useEndpointCoords) {
|
|
18037
|
+
// Override toSVG to prevent Fabric.js from adding transform wrapper
|
|
18038
|
+
const markup = this._toSVG().join('');
|
|
18039
|
+
return reviver ? reviver(markup) : markup;
|
|
18040
|
+
}
|
|
18041
|
+
// Use default behavior for legacy mode
|
|
18042
|
+
return super.toSVG(reviver);
|
|
18028
18043
|
}
|
|
18029
18044
|
static async fromElement(element, options, cssRules) {
|
|
18030
18045
|
const {
|