@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.js
CHANGED
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
}
|
|
361
361
|
const cache = new Cache();
|
|
362
362
|
|
|
363
|
-
var version = "7.0.1-
|
|
363
|
+
var version = "7.0.1-beta5";
|
|
364
364
|
|
|
365
365
|
// use this syntax so babel plugin see this import here
|
|
366
366
|
const VERSION = version;
|
|
@@ -17707,14 +17707,14 @@
|
|
|
17707
17707
|
}
|
|
17708
17708
|
setCoords() {
|
|
17709
17709
|
if (this._useEndpointCoords) {
|
|
17710
|
-
|
|
17711
|
-
const
|
|
17712
|
-
|
|
17713
|
-
|
|
17710
|
+
// Set the object's center to the geometric center of the line
|
|
17711
|
+
const center = this._findCenterFromElement();
|
|
17712
|
+
this.left = center.x;
|
|
17713
|
+
this.top = center.y;
|
|
17714
|
+
|
|
17715
|
+
// Set width and height for hit detection and bounding box
|
|
17714
17716
|
const effectiveStrokeWidth = this.hitStrokeWidth === 'auto' ? this.strokeWidth : this.hitStrokeWidth;
|
|
17715
17717
|
const hitPadding = Math.max(effectiveStrokeWidth / 2 + 5, 10);
|
|
17716
|
-
this.left = minX - hitPadding + (maxX - minX + hitPadding * 2) / 2;
|
|
17717
|
-
this.top = minY - hitPadding + (maxY - minY + hitPadding * 2) / 2;
|
|
17718
17718
|
this.width = Math.abs(this.x2 - this.x1) + hitPadding * 2;
|
|
17719
17719
|
this.height = Math.abs(this.y2 - this.y1) + hitPadding * 2;
|
|
17720
17720
|
}
|
|
@@ -17968,13 +17968,28 @@
|
|
|
17968
17968
|
};
|
|
17969
17969
|
}
|
|
17970
17970
|
_toSVG() {
|
|
17971
|
-
|
|
17972
|
-
|
|
17973
|
-
x2
|
|
17974
|
-
|
|
17975
|
-
|
|
17976
|
-
|
|
17977
|
-
|
|
17971
|
+
if (this._useEndpointCoords) {
|
|
17972
|
+
// Use absolute coordinates to bypass all Fabric.js transforms
|
|
17973
|
+
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`];
|
|
17974
|
+
} else {
|
|
17975
|
+
// Use standard calcLinePoints for legacy mode
|
|
17976
|
+
const {
|
|
17977
|
+
x1,
|
|
17978
|
+
x2,
|
|
17979
|
+
y1,
|
|
17980
|
+
y2
|
|
17981
|
+
} = this.calcLinePoints();
|
|
17982
|
+
return ['<line ', 'COMMON_PARTS', `x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" />\n`];
|
|
17983
|
+
}
|
|
17984
|
+
}
|
|
17985
|
+
toSVG(reviver) {
|
|
17986
|
+
if (this._useEndpointCoords) {
|
|
17987
|
+
// Override toSVG to prevent Fabric.js from adding transform wrapper
|
|
17988
|
+
const markup = this._toSVG().join('');
|
|
17989
|
+
return reviver ? reviver(markup) : markup;
|
|
17990
|
+
}
|
|
17991
|
+
// Use default behavior for legacy mode
|
|
17992
|
+
return super.toSVG(reviver);
|
|
17978
17993
|
}
|
|
17979
17994
|
static async fromElement(element, options, cssRules) {
|
|
17980
17995
|
const {
|