fabric 6.0.0-beta19 → 6.0.0-beta20
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/CHANGELOG.md +19 -0
- package/dist/index.js +86 -38
- 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 +86 -38
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +86 -38
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +86 -38
- 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/LayoutManager/LayoutManager.d.ts.map +1 -1
- package/dist/src/LayoutManager/LayoutManager.min.mjs.map +1 -1
- package/dist/src/LayoutManager/LayoutManager.mjs +3 -0
- package/dist/src/LayoutManager/LayoutManager.mjs.map +1 -1
- package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.d.ts.map +1 -1
- package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.min.mjs +1 -1
- package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.min.mjs.map +1 -1
- package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.mjs +3 -7
- package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.mjs.map +1 -1
- package/dist/src/Pattern/Pattern.d.ts.map +1 -1
- package/dist/src/Pattern/Pattern.min.mjs.map +1 -1
- package/dist/src/Pattern/Pattern.mjs.map +1 -1
- package/dist/src/Shadow.d.ts +1 -1
- package/dist/src/Shadow.d.ts.map +1 -1
- package/dist/src/Shadow.min.mjs +1 -1
- package/dist/src/Shadow.min.mjs.map +1 -1
- package/dist/src/Shadow.mjs +1 -1
- package/dist/src/Shadow.mjs.map +1 -1
- package/dist/src/canvas/Canvas.d.ts +1 -1
- package/dist/src/canvas/Canvas.d.ts.map +1 -1
- package/dist/src/canvas/Canvas.min.mjs +1 -1
- package/dist/src/canvas/Canvas.min.mjs.map +1 -1
- package/dist/src/canvas/Canvas.mjs +2 -2
- package/dist/src/canvas/Canvas.mjs.map +1 -1
- package/dist/src/canvas/SelectableCanvas.d.ts +1 -1
- package/dist/src/canvas/SelectableCanvas.d.ts.map +1 -1
- package/dist/src/canvas/SelectableCanvas.min.mjs.map +1 -1
- package/dist/src/canvas/SelectableCanvas.mjs.map +1 -1
- package/dist/src/canvas/StaticCanvas.min.mjs +1 -1
- package/dist/src/canvas/StaticCanvas.min.mjs.map +1 -1
- package/dist/src/canvas/StaticCanvas.mjs +1 -1
- package/dist/src/canvas/StaticCanvas.mjs.map +1 -1
- package/dist/src/filters/WebGLFilterBackend.min.mjs.map +1 -1
- package/dist/src/filters/WebGLFilterBackend.mjs.map +1 -1
- package/dist/src/parser/elements_parser.d.ts.map +1 -1
- package/dist/src/parser/elements_parser.min.mjs +1 -1
- package/dist/src/parser/elements_parser.min.mjs.map +1 -1
- package/dist/src/parser/elements_parser.mjs +14 -2
- package/dist/src/parser/elements_parser.mjs.map +1 -1
- package/dist/src/parser/getCSSRules.d.ts.map +1 -1
- package/dist/src/parser/getCSSRules.min.mjs +1 -1
- package/dist/src/parser/getCSSRules.min.mjs.map +1 -1
- package/dist/src/parser/getCSSRules.mjs +6 -0
- package/dist/src/parser/getCSSRules.mjs.map +1 -1
- package/dist/src/parser/getTagName.d.ts +2 -0
- package/dist/src/parser/getTagName.d.ts.map +1 -0
- package/dist/src/parser/getTagName.min.mjs +2 -0
- package/dist/src/parser/getTagName.min.mjs.map +1 -0
- package/dist/src/parser/getTagName.mjs +4 -0
- package/dist/src/parser/getTagName.mjs.map +1 -0
- package/dist/src/parser/hasInvalidAncestor.d.ts.map +1 -1
- package/dist/src/parser/hasInvalidAncestor.min.mjs +1 -1
- package/dist/src/parser/hasInvalidAncestor.min.mjs.map +1 -1
- package/dist/src/parser/hasInvalidAncestor.mjs +2 -1
- package/dist/src/parser/hasInvalidAncestor.mjs.map +1 -1
- package/dist/src/parser/parseSVGDocument.d.ts.map +1 -1
- package/dist/src/parser/parseSVGDocument.min.mjs +1 -1
- package/dist/src/parser/parseSVGDocument.min.mjs.map +1 -1
- package/dist/src/parser/parseSVGDocument.mjs +4 -2
- package/dist/src/parser/parseSVGDocument.mjs.map +1 -1
- package/dist/src/shapes/ActiveSelection.d.ts +7 -4
- package/dist/src/shapes/ActiveSelection.d.ts.map +1 -1
- package/dist/src/shapes/ActiveSelection.min.mjs +1 -1
- package/dist/src/shapes/ActiveSelection.min.mjs.map +1 -1
- package/dist/src/shapes/ActiveSelection.mjs +18 -3
- package/dist/src/shapes/ActiveSelection.mjs.map +1 -1
- package/dist/src/shapes/Circle.d.ts +14 -8
- package/dist/src/shapes/Circle.d.ts.map +1 -1
- package/dist/src/shapes/Circle.min.mjs +1 -1
- package/dist/src/shapes/Circle.min.mjs.map +1 -1
- package/dist/src/shapes/Circle.mjs +7 -5
- package/dist/src/shapes/Circle.mjs.map +1 -1
- package/dist/src/shapes/Ellipse.d.ts +3 -5
- package/dist/src/shapes/Ellipse.d.ts.map +1 -1
- package/dist/src/shapes/Ellipse.min.mjs.map +1 -1
- package/dist/src/shapes/Ellipse.mjs.map +1 -1
- package/dist/src/shapes/Group.d.ts +2 -6
- package/dist/src/shapes/Group.d.ts.map +1 -1
- package/dist/src/shapes/Group.min.mjs.map +1 -1
- package/dist/src/shapes/Group.mjs.map +1 -1
- package/dist/src/shapes/IText/IText.d.ts +6 -27
- package/dist/src/shapes/IText/IText.d.ts.map +1 -1
- package/dist/src/shapes/IText/IText.min.mjs +1 -1
- package/dist/src/shapes/IText/IText.min.mjs.map +1 -1
- package/dist/src/shapes/IText/IText.mjs +9 -6
- package/dist/src/shapes/IText/IText.mjs.map +1 -1
- package/dist/src/shapes/Image.d.ts +3 -5
- package/dist/src/shapes/Image.d.ts.map +1 -1
- package/dist/src/shapes/Image.min.mjs +1 -1
- package/dist/src/shapes/Image.min.mjs.map +1 -1
- package/dist/src/shapes/Image.mjs +3 -2
- package/dist/src/shapes/Image.mjs.map +1 -1
- package/dist/src/shapes/Object/InteractiveObject.d.ts +1 -1
- package/dist/src/shapes/Object/InteractiveObject.d.ts.map +1 -1
- package/dist/src/shapes/Object/InteractiveObject.min.mjs +1 -1
- package/dist/src/shapes/Object/InteractiveObject.min.mjs.map +1 -1
- package/dist/src/shapes/Object/InteractiveObject.mjs +6 -1
- package/dist/src/shapes/Object/InteractiveObject.mjs.map +1 -1
- package/dist/src/shapes/Object/Object.d.ts +36 -8
- package/dist/src/shapes/Object/Object.d.ts.map +1 -1
- package/dist/src/shapes/Object/Object.min.mjs.map +1 -1
- package/dist/src/shapes/Object/Object.mjs +3 -3
- package/dist/src/shapes/Object/Object.mjs.map +1 -1
- package/dist/src/shapes/Object/defaultValues.d.ts +5 -73
- package/dist/src/shapes/Object/defaultValues.d.ts.map +1 -1
- package/dist/src/shapes/Object/defaultValues.min.mjs.map +1 -1
- package/dist/src/shapes/Object/defaultValues.mjs.map +1 -1
- package/dist/src/shapes/Polygon.d.ts +2 -4
- package/dist/src/shapes/Polygon.d.ts.map +1 -1
- package/dist/src/shapes/Polygon.min.mjs.map +1 -1
- package/dist/src/shapes/Polygon.mjs.map +1 -1
- package/dist/src/shapes/Polyline.d.ts +2 -4
- package/dist/src/shapes/Polyline.d.ts.map +1 -1
- package/dist/src/shapes/Polyline.min.mjs.map +1 -1
- package/dist/src/shapes/Polyline.mjs.map +1 -1
- package/dist/src/shapes/Rect.d.ts +1 -1
- package/dist/src/shapes/Rect.d.ts.map +1 -1
- package/dist/src/shapes/Rect.min.mjs.map +1 -1
- package/dist/src/shapes/Rect.mjs.map +1 -1
- package/dist/src/shapes/Text/Text.d.ts +2 -4
- package/dist/src/shapes/Text/Text.d.ts.map +1 -1
- package/dist/src/shapes/Text/Text.min.mjs +1 -1
- package/dist/src/shapes/Text/Text.min.mjs.map +1 -1
- package/dist/src/shapes/Text/Text.mjs +3 -1
- package/dist/src/shapes/Text/Text.mjs.map +1 -1
- package/dist/src/shapes/Text/TextSVGExportMixin.d.ts.map +1 -1
- package/dist/src/shapes/Text/TextSVGExportMixin.min.mjs.map +1 -1
- package/dist/src/shapes/Text/TextSVGExportMixin.mjs +2 -1
- package/dist/src/shapes/Text/TextSVGExportMixin.mjs.map +1 -1
- package/dist/src/shapes/Textbox.d.ts +2 -14
- package/dist/src/shapes/Textbox.d.ts.map +1 -1
- package/dist/src/shapes/Textbox.min.mjs.map +1 -1
- package/dist/src/shapes/Textbox.mjs +2 -1
- package/dist/src/shapes/Textbox.mjs.map +1 -1
- package/dist/src/shapes/Triangle.d.ts +4 -9
- package/dist/src/shapes/Triangle.d.ts.map +1 -1
- package/dist/src/shapes/Triangle.min.mjs.map +1 -1
- package/dist/src/shapes/Triangle.mjs.map +1 -1
- package/package.json +1 -3
- package/src/LayoutManager/LayoutManager.spec.ts +2 -2
- package/src/LayoutManager/LayoutManager.ts +3 -0
- package/src/LayoutManager/LayoutStrategies/LayoutStrategy.ts +3 -12
- package/src/LayoutManager/README.md +41 -0
- package/src/Pattern/Pattern.ts +12 -4
- package/src/Shadow.spec.ts +15 -0
- package/src/Shadow.ts +1 -1
- package/src/__snapshots__/Shadow.spec.ts.snap +27 -0
- package/src/canvas/Canvas.ts +3 -3
- package/src/canvas/SelectableCanvas.ts +1 -1
- package/src/canvas/StaticCanvas.ts +3 -3
- package/src/filters/WebGLFilterBackend.ts +2 -2
- package/src/parser/elements_parser.ts +23 -3
- package/src/parser/getCSSRules.spec.ts +24 -6
- package/src/parser/getCSSRules.ts +10 -0
- package/src/parser/getTagName.ts +1 -0
- package/src/parser/hasInvalidAncestor.ts +2 -1
- package/src/parser/parseSVGDocument.ts +4 -2
- package/src/shapes/ActiveSelection.spec.ts +22 -0
- package/src/shapes/ActiveSelection.ts +29 -4
- package/src/shapes/Circle.ts +26 -17
- package/src/shapes/Ellipse.ts +3 -3
- package/src/shapes/Group.ts +1 -1
- package/src/shapes/IText/IText.ts +14 -8
- package/src/shapes/Image.spec.ts +27 -0
- package/src/shapes/Image.ts +6 -6
- package/src/shapes/Object/InteractiveObject.ts +7 -2
- package/src/shapes/Object/Object.ts +36 -7
- package/src/shapes/Object/defaultValues.ts +9 -2
- package/src/shapes/Polygon.ts +2 -2
- package/src/shapes/Polyline.ts +2 -2
- package/src/shapes/Rect.ts +1 -1
- package/src/shapes/Text/Text.ts +5 -3
- package/src/shapes/Text/TextSVGExportMixin.ts +2 -1
- package/src/shapes/Textbox.ts +4 -3
- package/src/shapes/Triangle.ts +4 -4
- package/src/shapes/__snapshots__/Image.spec.ts.snap +22 -0
- package/typedoc.config.json +1 -2
- package/typedoc.json +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
## [next]
|
|
4
4
|
|
|
5
|
+
## [6.0.0-beta20]
|
|
6
|
+
|
|
7
|
+
- chore(TS): minor changes to typescript notation to be compatible with a 5.3.3 [#9725](https://github.com/fabricjs/fabric.js/pull/9725)
|
|
8
|
+
- fix(InteractiveObject): "borderOpacityWhenMoving" does not take effect on the child shapes within the group [#9374](https://github.com/fabricjs/fabric.js/issues/9734)
|
|
9
|
+
- fix(SVGParser): Consider the transformMatrix of the clipPath owner as part of the clipPath trasnformation [#9750](https://github.com/fabricjs/fabric.js/pull/9750)
|
|
10
|
+
- fix(StaticCanvas): setDimensions not requesting a render if options are not passed [#9710](https://github.com/fabricjs/fabric.js/pull/9710)
|
|
11
|
+
- fix(LayoutManager): wrong bounding box position when activeSelection has originX/originY that are not default left/top [#9649](https://github.com/fabricjs/fabric.js/pull/9649)
|
|
12
|
+
- fix(ActiveSelection): block ancestors/descendants of selected objects from being selected [#9732](https://github.com/fabricjs/fabric.js/pull/9732)
|
|
13
|
+
- fix(Image): typo in style property for svg export [#9717](https://github.com/fabricjs/fabric.js/pull/9717)
|
|
14
|
+
- ci(): Update the changelog and stats action to work from forks
|
|
15
|
+
- fix(Shadow): Cloning a shape with shadow throws an error[#9711](https://github.com/fabricjs/fabric.js/issues/9711)
|
|
16
|
+
- chore(TS): use consistent and improved types for getDefaults and ownDefaults [#9698](https://github.com/fabricjs/fabric.js/pull/9698)
|
|
17
|
+
- fix(SVGParser): Don't crash on nested CSS at-rules [#9707](https://github.com/fabricjs/fabric.js/pull/9707)
|
|
18
|
+
- perf(): measuring canvas size [#9697](https://github.com/fabricjs/fabric.js/pull/9697)
|
|
19
|
+
- chore(TS): Add type for options in toCanvasElement and toDataUrl [#9673](https://github.com/fabricjs/fabric.js/pull/9673)
|
|
20
|
+
- ci(): add source map support to node sandbox [#9686](https://github.com/fabricjs/fabric.js/pull/9686)
|
|
21
|
+
- fix(Canvas): Correct type mainTouchId initialization [#9684](https://github.com/fabricjs/fabric.js/pull/9684)
|
|
22
|
+
- feat(Circle): Add counterclockwise parameter to Circle class [#9670](https://github.com/fabricjs/fabric.js/pull/9670)
|
|
23
|
+
|
|
5
24
|
## [6.0.0-beta19]
|
|
6
25
|
|
|
7
26
|
- feat(LayoutManager): Expose objects registration [#9661](https://github.com/fabricjs/fabric.js/pull/9661)
|
package/dist/index.js
CHANGED
|
@@ -423,7 +423,7 @@
|
|
|
423
423
|
}
|
|
424
424
|
const cache = new Cache();
|
|
425
425
|
|
|
426
|
-
var version = "6.0.0-
|
|
426
|
+
var version = "6.0.0-beta20";
|
|
427
427
|
|
|
428
428
|
// use this syntax so babel plugin see this import here
|
|
429
429
|
const VERSION = version;
|
|
@@ -3252,7 +3252,7 @@
|
|
|
3252
3252
|
|
|
3253
3253
|
setDimensions(dimensions, options) {
|
|
3254
3254
|
this._setDimensionsImpl(dimensions, options);
|
|
3255
|
-
if (options
|
|
3255
|
+
if (!options || !options.cssOnly) {
|
|
3256
3256
|
this.requestRenderAll();
|
|
3257
3257
|
}
|
|
3258
3258
|
}
|
|
@@ -6777,7 +6777,7 @@
|
|
|
6777
6777
|
const defaults = Shadow.ownDefaults;
|
|
6778
6778
|
return !this.includeDefaultValues ? pickBy(data, (value, key) => value !== defaults[key]) : data;
|
|
6779
6779
|
}
|
|
6780
|
-
static fromObject(options) {
|
|
6780
|
+
static async fromObject(options) {
|
|
6781
6781
|
return new this(options);
|
|
6782
6782
|
}
|
|
6783
6783
|
}
|
|
@@ -7874,7 +7874,7 @@
|
|
|
7874
7874
|
* If you need to get a real Jpeg or Png from an object, using toDataURL is the right way to do it.
|
|
7875
7875
|
* toCanvasElement and then toBlob from the obtained canvas is also a good option.
|
|
7876
7876
|
* @todo fix the export type, it could not be Image but the type that getClass return for 'image'.
|
|
7877
|
-
* @param {
|
|
7877
|
+
* @param {ObjectToCanvasElementOptions} [options] for clone as image, passed to toDataURL
|
|
7878
7878
|
* @param {Number} [options.multiplier=1] Multiplier to scale by
|
|
7879
7879
|
* @param {Number} [options.left] Cropping left offset. Introduced in v1.2.14
|
|
7880
7880
|
* @param {Number} [options.top] Cropping top offset. Introduced in v1.2.14
|
|
@@ -7894,7 +7894,7 @@
|
|
|
7894
7894
|
|
|
7895
7895
|
/**
|
|
7896
7896
|
* Converts an object into a HTMLCanvas element
|
|
7897
|
-
* @param {
|
|
7897
|
+
* @param {ObjectToCanvasElementOptions} options Options object
|
|
7898
7898
|
* @param {Number} [options.multiplier=1] Multiplier to scale by
|
|
7899
7899
|
* @param {Number} [options.left] Cropping left offset. Introduced in v1.2.14
|
|
7900
7900
|
* @param {Number} [options.top] Cropping top offset. Introduced in v1.2.14
|
|
@@ -7904,7 +7904,7 @@
|
|
|
7904
7904
|
* @param {Boolean} [options.withoutTransform] Remove current object transform ( no scale , no angle, no flip, no skew ). Introduced in 2.3.4
|
|
7905
7905
|
* @param {Boolean} [options.withoutShadow] Remove current object shadow. Introduced in 2.4.2
|
|
7906
7906
|
* @param {Boolean} [options.viewportTransform] Account for canvas viewport transform
|
|
7907
|
-
* @param {(el
|
|
7907
|
+
* @param {(el?: HTMLCanvasElement) => StaticCanvas} [options.canvasProvider] Create the output canvas
|
|
7908
7908
|
* @return {HTMLCanvasElement} Returns DOM element <canvas> with the FabricObject
|
|
7909
7909
|
*/
|
|
7910
7910
|
toCanvasElement() {
|
|
@@ -9392,7 +9392,12 @@
|
|
|
9392
9392
|
ctx.save();
|
|
9393
9393
|
ctx.translate(options.translateX, options.translateY);
|
|
9394
9394
|
ctx.lineWidth = 1 * this.borderScaleFactor;
|
|
9395
|
-
|
|
9395
|
+
// since interactive groups have been introduced, an object could be inside a group and needing controls
|
|
9396
|
+
// the following equality check `this.group === this.parent` covers:
|
|
9397
|
+
// object without a group ( undefined === undefined )
|
|
9398
|
+
// object inside a group
|
|
9399
|
+
// excludes object inside a group but multi selected since group and parent will differ in value
|
|
9400
|
+
if (this.group === this.parent) {
|
|
9396
9401
|
ctx.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1;
|
|
9397
9402
|
}
|
|
9398
9403
|
if (this.flipX) {
|
|
@@ -10939,14 +10944,11 @@
|
|
|
10939
10944
|
size: bboxSize,
|
|
10940
10945
|
center: bboxCenter
|
|
10941
10946
|
});
|
|
10942
|
-
const originFactor = new Point(-resolveOrigin(target.originX), -resolveOrigin(target.originY));
|
|
10943
|
-
const sizeCorrection = actualSize.subtract(bboxSize).multiply(originFactor);
|
|
10944
|
-
// translate the layout origin from left top to target's origin
|
|
10945
|
-
const center = bboxLeftTop.add(bboxSize.multiply(originFactor));
|
|
10946
10947
|
return {
|
|
10947
10948
|
// in `initialization` we do not account for target's transformation matrix
|
|
10948
|
-
center:
|
|
10949
|
-
|
|
10949
|
+
center: bboxCenter,
|
|
10950
|
+
// TODO: investigate if this is still necessary
|
|
10951
|
+
relativeCorrection: new Point(0, 0),
|
|
10950
10952
|
size: actualSize
|
|
10951
10953
|
};
|
|
10952
10954
|
} else {
|
|
@@ -11155,6 +11157,9 @@
|
|
|
11155
11157
|
let {
|
|
11156
11158
|
offset
|
|
11157
11159
|
} = _ref;
|
|
11160
|
+
// TODO: this is here for cache invalidation.
|
|
11161
|
+
// verify if this is necessary since we have explicit
|
|
11162
|
+
// cache invalidation at the end of commitLayout
|
|
11158
11163
|
object.set({
|
|
11159
11164
|
left: object.left + offset.x,
|
|
11160
11165
|
top: object.top + offset.y
|
|
@@ -14651,7 +14656,7 @@
|
|
|
14651
14656
|
*/
|
|
14652
14657
|
_onTouchStart(e) {
|
|
14653
14658
|
e.preventDefault();
|
|
14654
|
-
if (this.mainTouchId ===
|
|
14659
|
+
if (this.mainTouchId === undefined) {
|
|
14655
14660
|
this.mainTouchId = this.getPointerId(e);
|
|
14656
14661
|
}
|
|
14657
14662
|
this.__onMouseDown(e);
|
|
@@ -14691,7 +14696,7 @@
|
|
|
14691
14696
|
}
|
|
14692
14697
|
this.__onMouseUp(e);
|
|
14693
14698
|
this._resetTransformEventData();
|
|
14694
|
-
this.mainTouchId
|
|
14699
|
+
delete this.mainTouchId;
|
|
14695
14700
|
const eventTypePrefix = this._getEventPrefix();
|
|
14696
14701
|
const doc = getDocumentFromElement(this.upperCanvasEl);
|
|
14697
14702
|
removeListener(doc, 'touchend', this._onTouchEnd, addEventOptions);
|
|
@@ -16738,11 +16743,12 @@
|
|
|
16738
16743
|
}
|
|
16739
16744
|
|
|
16740
16745
|
const _excluded$9 = ["left", "top", "radius"];
|
|
16741
|
-
const CIRCLE_PROPS = ['radius', 'startAngle', 'endAngle'];
|
|
16746
|
+
const CIRCLE_PROPS = ['radius', 'startAngle', 'endAngle', 'counterClockwise'];
|
|
16742
16747
|
const circleDefaultValues = {
|
|
16743
16748
|
radius: 0,
|
|
16744
16749
|
startAngle: 0,
|
|
16745
|
-
endAngle: 360
|
|
16750
|
+
endAngle: 360,
|
|
16751
|
+
counterClockwise: false
|
|
16746
16752
|
};
|
|
16747
16753
|
class Circle extends FabricObject {
|
|
16748
16754
|
static getDefaults() {
|
|
@@ -16768,7 +16774,7 @@
|
|
|
16768
16774
|
*/
|
|
16769
16775
|
_render(ctx) {
|
|
16770
16776
|
ctx.beginPath();
|
|
16771
|
-
ctx.arc(0, 0, this.radius, degreesToRadians(this.startAngle), degreesToRadians(this.endAngle),
|
|
16777
|
+
ctx.arc(0, 0, this.radius, degreesToRadians(this.startAngle), degreesToRadians(this.endAngle), this.counterClockwise);
|
|
16772
16778
|
this._renderPaintInOrder(ctx);
|
|
16773
16779
|
}
|
|
16774
16780
|
|
|
@@ -16830,8 +16836,9 @@
|
|
|
16830
16836
|
startY = sin(start) * radius,
|
|
16831
16837
|
endX = cos(end) * radius,
|
|
16832
16838
|
endY = sin(end) * radius,
|
|
16833
|
-
largeFlag = angle > 180 ?
|
|
16834
|
-
|
|
16839
|
+
largeFlag = angle > 180 ? 1 : 0,
|
|
16840
|
+
sweepFlag = this.counterClockwise ? 0 : 1;
|
|
16841
|
+
return ["<path d=\"M ".concat(startX, " ").concat(startY, " A ").concat(radius, " ").concat(radius, " 0 ").concat(largeFlag, " ").concat(sweepFlag, " ").concat(endX, " ").concat(endY, "\" "), 'COMMON_PARTS', ' />\n'];
|
|
16835
16842
|
}
|
|
16836
16843
|
}
|
|
16837
16844
|
/* _TO_SVG_END_ */
|
|
@@ -18539,7 +18546,8 @@
|
|
|
18539
18546
|
* @return {String}
|
|
18540
18547
|
*/
|
|
18541
18548
|
getSvgStyles(skipShadow) {
|
|
18542
|
-
//
|
|
18549
|
+
// cant use ts-expect-error because of ts 5.3 cross check
|
|
18550
|
+
// @ts-ignore TS doesn't respect this type casting
|
|
18543
18551
|
return "".concat(super.getSvgStyles(skipShadow), " white-space: pre;");
|
|
18544
18552
|
}
|
|
18545
18553
|
|
|
@@ -18583,7 +18591,9 @@
|
|
|
18583
18591
|
*/
|
|
18584
18592
|
function getMeasuringContext() {
|
|
18585
18593
|
if (!measuringContext) {
|
|
18586
|
-
|
|
18594
|
+
const canvas = createCanvasElement();
|
|
18595
|
+
canvas.width = canvas.height = 0;
|
|
18596
|
+
measuringContext = canvas.getContext('2d');
|
|
18587
18597
|
}
|
|
18588
18598
|
return measuringContext;
|
|
18589
18599
|
}
|
|
@@ -21942,7 +21952,13 @@
|
|
|
21942
21952
|
65: 'selectAll'
|
|
21943
21953
|
};
|
|
21944
21954
|
|
|
21945
|
-
|
|
21955
|
+
// Declare IText protected properties to workaround TS
|
|
21956
|
+
const protectedDefaultValues = {
|
|
21957
|
+
_selectionDirection: null,
|
|
21958
|
+
_reSpace: /\s|\r?\n/,
|
|
21959
|
+
inCompositionMode: false
|
|
21960
|
+
};
|
|
21961
|
+
const iTextDefaultValues = _objectSpread2({
|
|
21946
21962
|
selectionStart: 0,
|
|
21947
21963
|
selectionEnd: 0,
|
|
21948
21964
|
selectionColor: 'rgba(17,119,255,0.3)',
|
|
@@ -21955,14 +21971,11 @@
|
|
|
21955
21971
|
cursorDuration: 600,
|
|
21956
21972
|
caching: true,
|
|
21957
21973
|
hiddenTextareaContainer: null,
|
|
21958
|
-
_selectionDirection: null,
|
|
21959
|
-
_reSpace: /\s|\r?\n/,
|
|
21960
|
-
inCompositionMode: false,
|
|
21961
21974
|
keysMap,
|
|
21962
21975
|
keysMapRtl,
|
|
21963
21976
|
ctrlKeysMapDown,
|
|
21964
21977
|
ctrlKeysMapUp
|
|
21965
|
-
};
|
|
21978
|
+
}, protectedDefaultValues);
|
|
21966
21979
|
|
|
21967
21980
|
// @TODO this is not complete
|
|
21968
21981
|
|
|
@@ -22937,7 +22950,8 @@
|
|
|
22937
22950
|
* @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output
|
|
22938
22951
|
* @return {Object} object representation of an instance
|
|
22939
22952
|
*/
|
|
22940
|
-
//
|
|
22953
|
+
// cant use ts-expect-error because of ts 5.3 cross check
|
|
22954
|
+
// @ts-ignore TS this typing limitations
|
|
22941
22955
|
toObject() {
|
|
22942
22956
|
let propertiesToInclude = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
22943
22957
|
return super.toObject(['minWidth', 'splitByGrapheme', ...propertiesToInclude]);
|
|
@@ -23047,6 +23061,10 @@
|
|
|
23047
23061
|
_defineProperty(FixedLayout, "type", 'fixed');
|
|
23048
23062
|
classRegistry.setClass(FixedLayout);
|
|
23049
23063
|
|
|
23064
|
+
const activeSelectionDefaultValues = {
|
|
23065
|
+
multiSelectionStacking: 'canvas-stacking'
|
|
23066
|
+
};
|
|
23067
|
+
|
|
23050
23068
|
/**
|
|
23051
23069
|
* Used by Canvas to manage selection.
|
|
23052
23070
|
*
|
|
@@ -23109,6 +23127,18 @@
|
|
|
23109
23127
|
}
|
|
23110
23128
|
}
|
|
23111
23129
|
|
|
23130
|
+
/**
|
|
23131
|
+
* @override block ancestors/descendants of selected objects from being selected to prevent a circular object tree
|
|
23132
|
+
*/
|
|
23133
|
+
canEnterGroup(object) {
|
|
23134
|
+
if (this.getObjects().some(o => o.isDescendantOf(object) || object.isDescendantOf(o))) {
|
|
23135
|
+
// prevent circular object tree
|
|
23136
|
+
log('error', 'ActiveSelection: circular object trees are not supported, this call has no effect');
|
|
23137
|
+
return false;
|
|
23138
|
+
}
|
|
23139
|
+
return super.canEnterGroup(object);
|
|
23140
|
+
}
|
|
23141
|
+
|
|
23112
23142
|
/**
|
|
23113
23143
|
* Change an object so that it can be part of an active selection.
|
|
23114
23144
|
* this method is called by multiselectAdd from canvas code.
|
|
@@ -23232,9 +23262,7 @@
|
|
|
23232
23262
|
}
|
|
23233
23263
|
}
|
|
23234
23264
|
_defineProperty(ActiveSelection, "type", 'ActiveSelection');
|
|
23235
|
-
_defineProperty(ActiveSelection, "ownDefaults",
|
|
23236
|
-
multiSelectionStacking: 'canvas-stacking'
|
|
23237
|
-
});
|
|
23265
|
+
_defineProperty(ActiveSelection, "ownDefaults", activeSelectionDefaultValues);
|
|
23238
23266
|
classRegistry.setClass(ActiveSelection);
|
|
23239
23267
|
classRegistry.setClass(ActiveSelection, 'activeSelection');
|
|
23240
23268
|
|
|
@@ -23875,7 +23903,7 @@
|
|
|
23875
23903
|
if (this.stroke || this.strokeDashArray) {
|
|
23876
23904
|
const origFill = this.fill;
|
|
23877
23905
|
this.fill = null;
|
|
23878
|
-
strokeSvg = ["\t<rect x=\"".concat(x, "\" y=\"").concat(y, "\" width=\"").concat(this.width, "\" height=\"").concat(this.height, "\"
|
|
23906
|
+
strokeSvg = ["\t<rect x=\"".concat(x, "\" y=\"").concat(y, "\" width=\"").concat(this.width, "\" height=\"").concat(this.height, "\" style=\"").concat(this.getSvgStyles(), "\" />\n")];
|
|
23879
23907
|
this.fill = origFill;
|
|
23880
23908
|
}
|
|
23881
23909
|
if (this.paintFirst !== 'fill') {
|
|
@@ -24046,7 +24074,8 @@
|
|
|
24046
24074
|
*/
|
|
24047
24075
|
drawCacheOnCanvas(ctx) {
|
|
24048
24076
|
ctx.imageSmoothingEnabled = this.imageSmoothing;
|
|
24049
|
-
//
|
|
24077
|
+
// cant use ts-expect-error because of ts 5.3 cross check
|
|
24078
|
+
// @ts-ignore TS doesn't respect this type casting
|
|
24050
24079
|
super.drawCacheOnCanvas(ctx);
|
|
24051
24080
|
}
|
|
24052
24081
|
|
|
@@ -24410,11 +24439,13 @@
|
|
|
24410
24439
|
return parsedDim;
|
|
24411
24440
|
}
|
|
24412
24441
|
|
|
24442
|
+
const getTagName = node => node.tagName.replace('svg:', '');
|
|
24443
|
+
|
|
24413
24444
|
const svgInvalidAncestorsRegEx = getSvgRegex(svgInvalidAncestors);
|
|
24414
24445
|
function hasInvalidAncestor(element) {
|
|
24415
24446
|
let _element = element;
|
|
24416
24447
|
while (_element && (_element = _element.parentElement)) {
|
|
24417
|
-
if (_element && _element.nodeName && svgInvalidAncestorsRegEx.test(_element
|
|
24448
|
+
if (_element && _element.nodeName && svgInvalidAncestorsRegEx.test(getTagName(_element)) && !_element.getAttribute('instantiated_by_use')) {
|
|
24418
24449
|
return true;
|
|
24419
24450
|
}
|
|
24420
24451
|
}
|
|
@@ -24575,6 +24606,12 @@
|
|
|
24575
24606
|
.filter((rule, index, array) => array.length > 1 && rule.trim())
|
|
24576
24607
|
// at this point we have hopefully an array of rules `body { style code... `
|
|
24577
24608
|
.forEach(rule => {
|
|
24609
|
+
// if there is more than one opening bracket and the rule starts with '@', it is likely
|
|
24610
|
+
// a nested at-rule like @media, @supports, @scope, etc. Ignore these as the code below
|
|
24611
|
+
// can not handle it.
|
|
24612
|
+
if ((rule.match(/{/g) || []).length > 1 && rule.trim().startsWith('@')) {
|
|
24613
|
+
return;
|
|
24614
|
+
}
|
|
24578
24615
|
const match = rule.split('{'),
|
|
24579
24616
|
ruleObj = {},
|
|
24580
24617
|
declaration = match[1].trim(),
|
|
@@ -24600,7 +24637,7 @@
|
|
|
24600
24637
|
return allRules;
|
|
24601
24638
|
}
|
|
24602
24639
|
|
|
24603
|
-
const findTag = el => classRegistry.getSVGClass(el.
|
|
24640
|
+
const findTag = el => classRegistry.getSVGClass(getTagName(el).toLowerCase());
|
|
24604
24641
|
class ElementsParser {
|
|
24605
24642
|
constructor(elements, options, reviver, doc, clipPaths) {
|
|
24606
24643
|
this.elements = elements;
|
|
@@ -24656,17 +24693,27 @@
|
|
|
24656
24693
|
obj.set(property, gradient);
|
|
24657
24694
|
}
|
|
24658
24695
|
}
|
|
24696
|
+
|
|
24697
|
+
// TODO: resolveClipPath could be run once per clippath with minor work per object.
|
|
24698
|
+
// is a refactor that i m not sure is worth on this code
|
|
24659
24699
|
async resolveClipPath(obj, usingElement) {
|
|
24660
24700
|
const clipPathElements = this.extractPropertyDefinition(obj, 'clipPath', this.clipPaths);
|
|
24661
24701
|
if (clipPathElements) {
|
|
24662
24702
|
const objTransformInv = invertTransform(obj.calcTransformMatrix());
|
|
24663
|
-
// move the clipPath tag as sibling to the real element that is using it
|
|
24664
24703
|
const clipPathTag = clipPathElements[0].parentElement;
|
|
24665
24704
|
let clipPathOwner = usingElement;
|
|
24666
24705
|
while (clipPathOwner.parentElement && clipPathOwner.getAttribute('clip-path') !== obj.clipPath) {
|
|
24667
24706
|
clipPathOwner = clipPathOwner.parentElement;
|
|
24668
24707
|
}
|
|
24708
|
+
// move the clipPath tag as sibling to the real element that is using it
|
|
24669
24709
|
clipPathOwner.parentElement.appendChild(clipPathTag);
|
|
24710
|
+
|
|
24711
|
+
// this multiplication order could be opposite.
|
|
24712
|
+
// but i don't have an svg to test it
|
|
24713
|
+
// at the first SVG that has a transform on both places and is misplaced
|
|
24714
|
+
// try to invert this multiplication order
|
|
24715
|
+
const finalTransform = parseTransformAttribute("".concat(clipPathOwner.getAttribute('transform') || '', " ").concat(clipPathTag.getAttribute('originalTransform') || ''));
|
|
24716
|
+
clipPathTag.setAttribute('transform', "matrix(".concat(finalTransform.join(','), ")"));
|
|
24670
24717
|
const container = await Promise.all(clipPathElements.map(clipPathElement => {
|
|
24671
24718
|
return findTag(clipPathElement).fromElement(clipPathElement, this.options, this.cssRules).then(enlivedClippath => {
|
|
24672
24719
|
removeTransformMatrixForSvgParsing(enlivedClippath);
|
|
@@ -24709,7 +24756,7 @@
|
|
|
24709
24756
|
}
|
|
24710
24757
|
}
|
|
24711
24758
|
|
|
24712
|
-
const isValidSvgTag = el => svgValidTagNamesRegEx.test(el
|
|
24759
|
+
const isValidSvgTag = el => svgValidTagNamesRegEx.test(getTagName(el));
|
|
24713
24760
|
const createEmptyResponse = () => ({
|
|
24714
24761
|
objects: [],
|
|
24715
24762
|
elements: [],
|
|
@@ -24763,7 +24810,8 @@
|
|
|
24763
24810
|
});
|
|
24764
24811
|
}
|
|
24765
24812
|
const localClipPaths = {};
|
|
24766
|
-
descendants.filter(el => el
|
|
24813
|
+
descendants.filter(el => getTagName(el) === 'clipPath').forEach(el => {
|
|
24814
|
+
el.setAttribute('originalTransform', el.getAttribute('transform') || '');
|
|
24767
24815
|
const id = el.getAttribute('id');
|
|
24768
24816
|
localClipPaths[id] = Array.from(el.getElementsByTagName('*')).filter(el => isValidSvgTag(el));
|
|
24769
24817
|
});
|