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