@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.mjs
CHANGED
|
@@ -354,7 +354,7 @@ class Cache {
|
|
|
354
354
|
}
|
|
355
355
|
const cache = new Cache();
|
|
356
356
|
|
|
357
|
-
var version = "7.0.1-
|
|
357
|
+
var version = "7.0.1-beta5";
|
|
358
358
|
|
|
359
359
|
// use this syntax so babel plugin see this import here
|
|
360
360
|
const VERSION = version;
|
|
@@ -17701,14 +17701,14 @@ class Line extends FabricObject {
|
|
|
17701
17701
|
}
|
|
17702
17702
|
setCoords() {
|
|
17703
17703
|
if (this._useEndpointCoords) {
|
|
17704
|
-
|
|
17705
|
-
const
|
|
17706
|
-
|
|
17707
|
-
|
|
17704
|
+
// Set the object's center to the geometric center of the line
|
|
17705
|
+
const center = this._findCenterFromElement();
|
|
17706
|
+
this.left = center.x;
|
|
17707
|
+
this.top = center.y;
|
|
17708
|
+
|
|
17709
|
+
// Set width and height for hit detection and bounding box
|
|
17708
17710
|
const effectiveStrokeWidth = this.hitStrokeWidth === 'auto' ? this.strokeWidth : this.hitStrokeWidth;
|
|
17709
17711
|
const hitPadding = Math.max(effectiveStrokeWidth / 2 + 5, 10);
|
|
17710
|
-
this.left = minX - hitPadding + (maxX - minX + hitPadding * 2) / 2;
|
|
17711
|
-
this.top = minY - hitPadding + (maxY - minY + hitPadding * 2) / 2;
|
|
17712
17712
|
this.width = Math.abs(this.x2 - this.x1) + hitPadding * 2;
|
|
17713
17713
|
this.height = Math.abs(this.y2 - this.y1) + hitPadding * 2;
|
|
17714
17714
|
}
|
|
@@ -17962,13 +17962,28 @@ class Line extends FabricObject {
|
|
|
17962
17962
|
};
|
|
17963
17963
|
}
|
|
17964
17964
|
_toSVG() {
|
|
17965
|
-
|
|
17966
|
-
|
|
17967
|
-
x2
|
|
17968
|
-
|
|
17969
|
-
|
|
17970
|
-
|
|
17971
|
-
|
|
17965
|
+
if (this._useEndpointCoords) {
|
|
17966
|
+
// Use absolute coordinates to bypass all Fabric.js transforms
|
|
17967
|
+
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`];
|
|
17968
|
+
} else {
|
|
17969
|
+
// Use standard calcLinePoints for legacy mode
|
|
17970
|
+
const {
|
|
17971
|
+
x1,
|
|
17972
|
+
x2,
|
|
17973
|
+
y1,
|
|
17974
|
+
y2
|
|
17975
|
+
} = this.calcLinePoints();
|
|
17976
|
+
return ['<line ', 'COMMON_PARTS', `x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" />\n`];
|
|
17977
|
+
}
|
|
17978
|
+
}
|
|
17979
|
+
toSVG(reviver) {
|
|
17980
|
+
if (this._useEndpointCoords) {
|
|
17981
|
+
// Override toSVG to prevent Fabric.js from adding transform wrapper
|
|
17982
|
+
const markup = this._toSVG().join('');
|
|
17983
|
+
return reviver ? reviver(markup) : markup;
|
|
17984
|
+
}
|
|
17985
|
+
// Use default behavior for legacy mode
|
|
17986
|
+
return super.toSVG(reviver);
|
|
17972
17987
|
}
|
|
17973
17988
|
static async fromElement(element, options, cssRules) {
|
|
17974
17989
|
const {
|