fabric 6.0.0 → 6.0.2
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 +12 -0
- package/README.md +8 -18
- package/dist/fabric.d.ts +4 -0
- package/dist/fabric.d.ts.map +1 -1
- package/dist/fabric.min.mjs +1 -1
- package/dist/fabric.mjs +1 -0
- package/dist/fabric.mjs.map +1 -1
- package/dist/index.js +146 -107
- 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 +146 -108
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +146 -107
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +146 -108
- 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/EventTypeDefs.d.ts +2 -1
- package/dist/src/EventTypeDefs.d.ts.map +1 -1
- package/dist/src/LayoutManager/LayoutManager.d.ts.map +1 -1
- package/dist/src/LayoutManager/LayoutManager.min.mjs +1 -1
- package/dist/src/LayoutManager/LayoutManager.min.mjs.map +1 -1
- package/dist/src/LayoutManager/LayoutManager.mjs +13 -8
- package/dist/src/LayoutManager/LayoutManager.mjs.map +1 -1
- package/dist/src/LayoutManager/LayoutStrategies/ClipPathLayout.min.mjs +1 -1
- package/dist/src/LayoutManager/LayoutStrategies/ClipPathLayout.min.mjs.map +1 -1
- package/dist/src/LayoutManager/LayoutStrategies/ClipPathLayout.mjs +3 -3
- package/dist/src/LayoutManager/LayoutStrategies/ClipPathLayout.mjs.map +1 -1
- package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.d.ts +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 +15 -9
- package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.mjs.map +1 -1
- package/dist/src/Observable.d.ts +8 -0
- package/dist/src/Observable.d.ts.map +1 -1
- package/dist/src/Observable.min.mjs.map +1 -1
- package/dist/src/Observable.mjs +8 -0
- package/dist/src/Observable.mjs.map +1 -1
- package/dist/src/canvas/SelectableCanvas.d.ts.map +1 -1
- package/dist/src/canvas/SelectableCanvas.min.mjs +1 -1
- package/dist/src/canvas/SelectableCanvas.min.mjs.map +1 -1
- package/dist/src/canvas/SelectableCanvas.mjs +5 -5
- package/dist/src/canvas/SelectableCanvas.mjs.map +1 -1
- package/dist/src/canvas/StaticCanvas.d.ts +1 -1
- package/dist/src/constants.d.ts +16 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.min.mjs +1 -1
- package/dist/src/constants.min.mjs.map +1 -1
- package/dist/src/constants.mjs +17 -1
- package/dist/src/constants.mjs.map +1 -1
- package/dist/src/controls/Control.d.ts.map +1 -1
- package/dist/src/controls/Control.min.mjs +1 -1
- package/dist/src/controls/Control.min.mjs.map +1 -1
- package/dist/src/controls/Control.mjs +2 -1
- package/dist/src/controls/Control.mjs.map +1 -1
- package/dist/src/controls/changeWidth.min.mjs +1 -1
- package/dist/src/controls/changeWidth.min.mjs.map +1 -1
- package/dist/src/controls/changeWidth.mjs +2 -2
- package/dist/src/controls/changeWidth.mjs.map +1 -1
- package/dist/src/controls/commonControls.d.ts.map +1 -1
- package/dist/src/controls/commonControls.min.mjs +1 -1
- package/dist/src/controls/commonControls.min.mjs.map +1 -1
- package/dist/src/controls/commonControls.mjs +4 -3
- package/dist/src/controls/commonControls.mjs.map +1 -1
- package/dist/src/controls/controlRendering.min.mjs +1 -1
- package/dist/src/controls/controlRendering.min.mjs.map +1 -1
- package/dist/src/controls/controlRendering.mjs +3 -3
- package/dist/src/controls/controlRendering.mjs.map +1 -1
- package/dist/src/controls/drag.min.mjs +1 -1
- package/dist/src/controls/drag.min.mjs.map +1 -1
- package/dist/src/controls/drag.mjs +2 -2
- package/dist/src/controls/drag.mjs.map +1 -1
- package/dist/src/controls/polyControl.d.ts.map +1 -1
- package/dist/src/controls/polyControl.min.mjs +1 -1
- package/dist/src/controls/polyControl.min.mjs.map +1 -1
- package/dist/src/controls/polyControl.mjs +2 -1
- package/dist/src/controls/polyControl.mjs.map +1 -1
- package/dist/src/controls/rotate.d.ts.map +1 -1
- package/dist/src/controls/rotate.min.mjs +1 -1
- package/dist/src/controls/rotate.min.mjs.map +1 -1
- package/dist/src/controls/rotate.mjs +2 -1
- package/dist/src/controls/rotate.mjs.map +1 -1
- package/dist/src/controls/scale.d.ts.map +1 -1
- package/dist/src/controls/scale.min.mjs +1 -1
- package/dist/src/controls/scale.min.mjs.map +1 -1
- package/dist/src/controls/scale.mjs +8 -7
- package/dist/src/controls/scale.mjs.map +1 -1
- package/dist/src/controls/scaleSkew.d.ts.map +1 -1
- package/dist/src/controls/scaleSkew.min.mjs +1 -1
- package/dist/src/controls/scaleSkew.min.mjs.map +1 -1
- package/dist/src/controls/scaleSkew.mjs +3 -2
- package/dist/src/controls/scaleSkew.mjs.map +1 -1
- package/dist/src/controls/skew.d.ts.map +1 -1
- package/dist/src/controls/skew.min.mjs +1 -1
- package/dist/src/controls/skew.min.mjs.map +1 -1
- package/dist/src/controls/skew.mjs +7 -7
- package/dist/src/controls/skew.mjs.map +1 -1
- package/dist/src/filters/Blur.min.mjs +1 -1
- package/dist/src/filters/Blur.min.mjs.map +1 -1
- package/dist/src/filters/Blur.mjs +1 -1
- package/dist/src/filters/Blur.mjs.map +1 -1
- package/dist/src/filters/Pixelate.min.mjs +1 -1
- package/dist/src/filters/Pixelate.min.mjs.map +1 -1
- package/dist/src/filters/Pixelate.mjs +1 -1
- package/dist/src/filters/Pixelate.mjs.map +1 -1
- package/dist/src/parser/attributes.d.ts.map +1 -1
- package/dist/src/parser/attributes.min.mjs +1 -1
- package/dist/src/parser/attributes.min.mjs.map +1 -1
- package/dist/src/parser/attributes.mjs +3 -1
- package/dist/src/parser/attributes.mjs.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 +3 -3
- package/dist/src/parser/elements_parser.mjs.map +1 -1
- package/dist/src/parser/normalizeValue.min.mjs +1 -1
- package/dist/src/parser/normalizeValue.min.mjs.map +1 -1
- package/dist/src/parser/normalizeValue.mjs +7 -7
- package/dist/src/parser/normalizeValue.mjs.map +1 -1
- package/dist/src/parser/parseTransformAttribute.min.mjs +1 -1
- package/dist/src/parser/parseTransformAttribute.min.mjs.map +1 -1
- package/dist/src/parser/parseTransformAttribute.mjs +5 -5
- package/dist/src/parser/parseTransformAttribute.mjs.map +1 -1
- 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 +3 -2
- package/dist/src/shapes/Circle.mjs.map +1 -1
- package/dist/src/shapes/Ellipse.min.mjs +1 -1
- package/dist/src/shapes/Ellipse.min.mjs.map +1 -1
- package/dist/src/shapes/Ellipse.mjs +3 -3
- package/dist/src/shapes/Ellipse.mjs.map +1 -1
- package/dist/src/shapes/IText/DraggableTextDelegate.min.mjs +1 -1
- package/dist/src/shapes/IText/DraggableTextDelegate.min.mjs.map +1 -1
- package/dist/src/shapes/IText/DraggableTextDelegate.mjs +3 -3
- package/dist/src/shapes/IText/DraggableTextDelegate.mjs.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 +3 -3
- package/dist/src/shapes/IText/IText.mjs.map +1 -1
- package/dist/src/shapes/IText/ITextBehavior.min.mjs +1 -1
- package/dist/src/shapes/IText/ITextBehavior.min.mjs.map +1 -1
- package/dist/src/shapes/IText/ITextBehavior.mjs +2 -2
- package/dist/src/shapes/IText/ITextBehavior.mjs.map +1 -1
- package/dist/src/shapes/IText/ITextKeyBehavior.min.mjs +1 -1
- package/dist/src/shapes/IText/ITextKeyBehavior.min.mjs.map +1 -1
- package/dist/src/shapes/IText/ITextKeyBehavior.mjs +2 -2
- package/dist/src/shapes/IText/ITextKeyBehavior.mjs.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 +2 -2
- package/dist/src/shapes/Image.mjs.map +1 -1
- package/dist/src/shapes/Object/AnimatableObject.d.ts.map +1 -1
- package/dist/src/shapes/Object/AnimatableObject.min.mjs +1 -1
- package/dist/src/shapes/Object/AnimatableObject.min.mjs.map +1 -1
- package/dist/src/shapes/Object/AnimatableObject.mjs +2 -1
- package/dist/src/shapes/Object/AnimatableObject.mjs.map +1 -1
- package/dist/src/shapes/Object/FabricObjectSVGExportMixin.d.ts.map +1 -1
- package/dist/src/shapes/Object/FabricObjectSVGExportMixin.min.mjs +1 -1
- package/dist/src/shapes/Object/FabricObjectSVGExportMixin.min.mjs.map +1 -1
- package/dist/src/shapes/Object/FabricObjectSVGExportMixin.mjs +4 -4
- package/dist/src/shapes/Object/FabricObjectSVGExportMixin.mjs.map +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 +2 -1
- package/dist/src/shapes/Object/InteractiveObject.mjs.map +1 -1
- package/dist/src/shapes/Object/Object.d.ts +9 -7
- package/dist/src/shapes/Object/Object.d.ts.map +1 -1
- package/dist/src/shapes/Object/Object.min.mjs +1 -1
- package/dist/src/shapes/Object/Object.min.mjs.map +1 -1
- package/dist/src/shapes/Object/Object.mjs +14 -12
- package/dist/src/shapes/Object/Object.mjs.map +1 -1
- package/dist/src/shapes/Object/ObjectGeometry.min.mjs +1 -1
- package/dist/src/shapes/Object/ObjectGeometry.min.mjs.map +1 -1
- package/dist/src/shapes/Object/ObjectGeometry.mjs +3 -3
- package/dist/src/shapes/Object/ObjectGeometry.mjs.map +1 -1
- package/dist/src/shapes/Object/defaultValues.d.ts.map +1 -1
- package/dist/src/shapes/Object/defaultValues.min.mjs +1 -1
- package/dist/src/shapes/Object/defaultValues.min.mjs.map +1 -1
- package/dist/src/shapes/Object/defaultValues.mjs +4 -4
- package/dist/src/shapes/Object/defaultValues.mjs.map +1 -1
- package/dist/src/shapes/Object/types/ControlProps.d.ts +4 -3
- package/dist/src/shapes/Object/types/ControlProps.d.ts.map +1 -1
- package/dist/src/shapes/Polyline.d.ts.map +1 -1
- package/dist/src/shapes/Polyline.min.mjs +1 -1
- package/dist/src/shapes/Polyline.min.mjs.map +1 -1
- package/dist/src/shapes/Polyline.mjs +3 -3
- package/dist/src/shapes/Polyline.mjs.map +1 -1
- package/dist/src/shapes/Text/Text.d.ts +2 -2
- 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 +5 -5
- 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 +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/Text/constants.min.mjs +1 -1
- package/dist/src/shapes/Text/constants.min.mjs.map +1 -1
- package/dist/src/shapes/Text/constants.mjs +2 -2
- package/dist/src/shapes/Text/constants.mjs.map +1 -1
- package/dist/src/util/misc/objectEnlive.d.ts +1 -0
- package/dist/src/util/misc/objectEnlive.d.ts.map +1 -1
- package/dist/src/util/misc/objectEnlive.min.mjs.map +1 -1
- package/dist/src/util/misc/objectEnlive.mjs +1 -0
- package/dist/src/util/misc/objectEnlive.mjs.map +1 -1
- package/dist/src/util/misc/svgParsing.min.mjs +1 -1
- package/dist/src/util/misc/svgParsing.min.mjs.map +1 -1
- package/dist/src/util/misc/svgParsing.mjs +2 -2
- package/dist/src/util/misc/svgParsing.mjs.map +1 -1
- package/dist/src/util/transform_matrix_removal.min.mjs +1 -1
- package/dist/src/util/transform_matrix_removal.min.mjs.map +1 -1
- package/dist/src/util/transform_matrix_removal.mjs +3 -3
- package/dist/src/util/transform_matrix_removal.mjs.map +1 -1
- package/fabric.ts +4 -0
- package/package.json +1 -1
- package/src/EventTypeDefs.ts +14 -6
- package/src/LayoutManager/LayoutManager.ts +28 -19
- package/src/LayoutManager/LayoutStrategies/ClipPathLayout.ts +2 -2
- package/src/LayoutManager/LayoutStrategies/LayoutStrategy.ts +7 -7
- package/src/Observable.ts +8 -0
- package/src/canvas/SelectableCanvas.ts +25 -11
- package/src/canvas/canvas_gestures.mixin.ts +6 -5
- package/src/constants.ts +17 -0
- package/src/controls/Control.ts +2 -1
- package/src/controls/changeWidth.ts +2 -2
- package/src/controls/commonControls.ts +4 -3
- package/src/controls/controlRendering.ts +3 -3
- package/src/controls/drag.ts +2 -2
- package/src/controls/polyControl.ts +2 -1
- package/src/controls/rotate.ts +2 -1
- package/src/controls/scale.ts +8 -7
- package/src/controls/scaleSkew.ts +3 -2
- package/src/controls/skew.ts +14 -7
- package/src/filters/Blur.ts +1 -1
- package/src/filters/Pixelate.ts +1 -1
- package/src/parser/attributes.ts +4 -2
- package/src/parser/elements_parser.ts +3 -3
- package/src/parser/normalizeValue.ts +7 -7
- package/src/parser/parseTransformAttribute.ts +5 -5
- package/src/shapes/Circle.ts +3 -2
- package/src/shapes/Ellipse.ts +3 -3
- package/src/shapes/IText/DraggableTextDelegate.ts +3 -3
- package/src/shapes/IText/IText.ts +3 -3
- package/src/shapes/IText/ITextBehavior.ts +2 -2
- package/src/shapes/IText/ITextKeyBehavior.ts +2 -2
- package/src/shapes/Image.ts +2 -2
- package/src/shapes/Object/AnimatableObject.ts +2 -1
- package/src/shapes/Object/FabricObjectSVGExportMixin.ts +4 -6
- package/src/shapes/Object/InteractiveObject.ts +2 -1
- package/src/shapes/Object/Object.ts +16 -11
- package/src/shapes/Object/ObjectGeometry.ts +3 -3
- package/src/shapes/Object/defaultValues.ts +17 -8
- package/src/shapes/Object/types/ControlProps.ts +4 -3
- package/src/shapes/Polyline.spec.ts +0 -1
- package/src/shapes/Polyline.ts +12 -4
- package/src/shapes/Text/Text.ts +7 -7
- package/src/shapes/Text/TextSVGExportMixin.ts +3 -2
- package/src/shapes/Text/constants.ts +3 -3
- package/src/util/misc/objectEnlive.ts +1 -0
- package/src/util/misc/svgParsing.ts +2 -2
- package/src/util/transform_matrix_removal.ts +3 -3
package/src/shapes/Polyline.ts
CHANGED
|
@@ -16,7 +16,15 @@ import { FabricObject, cacheProperties } from './Object/FabricObject';
|
|
|
16
16
|
import type { FabricObjectProps, SerializedObjectProps } from './Object/types';
|
|
17
17
|
import type { ObjectEvents } from '../EventTypeDefs';
|
|
18
18
|
import { cloneDeep } from '../util/internals/cloneDeep';
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
CENTER,
|
|
21
|
+
LEFT,
|
|
22
|
+
SCALE_X,
|
|
23
|
+
SCALE_Y,
|
|
24
|
+
SKEW_X,
|
|
25
|
+
SKEW_Y,
|
|
26
|
+
TOP,
|
|
27
|
+
} from '../constants';
|
|
20
28
|
import type { CSSRules } from '../parser/typedefs';
|
|
21
29
|
|
|
22
30
|
export const polylineDefaultValues: Partial<TClassProperties<Polyline>> = {
|
|
@@ -71,8 +79,8 @@ export class Polyline<
|
|
|
71
79
|
* @todo check if you really need to recalculate for all cases
|
|
72
80
|
*/
|
|
73
81
|
static layoutProperties: (keyof Polyline)[] = [
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
SKEW_X,
|
|
83
|
+
SKEW_Y,
|
|
76
84
|
'strokeLineCap',
|
|
77
85
|
'strokeLineJoin',
|
|
78
86
|
'strokeMiterLimit',
|
|
@@ -282,7 +290,7 @@ export class Polyline<
|
|
|
282
290
|
if (
|
|
283
291
|
this.exactBoundingBox &&
|
|
284
292
|
changed &&
|
|
285
|
-
(((key ===
|
|
293
|
+
(((key === SCALE_X || key === SCALE_Y) &&
|
|
286
294
|
this.strokeUniform &&
|
|
287
295
|
(this.constructor as typeof Polyline).layoutProperties.includes(
|
|
288
296
|
'strokeUniform'
|
package/src/shapes/Text/Text.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cache } from '../../cache';
|
|
2
|
-
import { DEFAULT_SVG_FONT_SIZE } from '../../constants';
|
|
2
|
+
import { DEFAULT_SVG_FONT_SIZE, FILL, STROKE } from '../../constants';
|
|
3
3
|
import type { ObjectEvents } from '../../EventTypeDefs';
|
|
4
4
|
import type {
|
|
5
5
|
CompleteTextStyleDeclaration,
|
|
@@ -94,7 +94,7 @@ interface UniqueTextProps {
|
|
|
94
94
|
charSpacing: number;
|
|
95
95
|
lineHeight: number;
|
|
96
96
|
fontSize: number;
|
|
97
|
-
fontWeight: string;
|
|
97
|
+
fontWeight: string | number;
|
|
98
98
|
fontFamily: string;
|
|
99
99
|
fontStyle: string;
|
|
100
100
|
pathSide: TPathSide;
|
|
@@ -176,7 +176,7 @@ export class FabricText<
|
|
|
176
176
|
* @type {(Number|String)}
|
|
177
177
|
* @default
|
|
178
178
|
*/
|
|
179
|
-
declare fontWeight: string;
|
|
179
|
+
declare fontWeight: string | number;
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
182
|
* Font family
|
|
@@ -621,7 +621,7 @@ export class FabricText<
|
|
|
621
621
|
* @param {CanvasRenderingContext2D} ctx Context to render on
|
|
622
622
|
*/
|
|
623
623
|
_renderText(ctx: CanvasRenderingContext2D) {
|
|
624
|
-
if (this.paintFirst ===
|
|
624
|
+
if (this.paintFirst === STROKE) {
|
|
625
625
|
this._renderTextStroke(ctx);
|
|
626
626
|
this._renderTextFill(ctx);
|
|
627
627
|
} else {
|
|
@@ -1100,7 +1100,7 @@ export class FabricText<
|
|
|
1100
1100
|
* @param {CanvasRenderingContext2D} ctx Context to render on
|
|
1101
1101
|
*/
|
|
1102
1102
|
_renderTextFill(ctx: CanvasRenderingContext2D) {
|
|
1103
|
-
if (!this.fill && !this.styleHas(
|
|
1103
|
+
if (!this.fill && !this.styleHas(FILL)) {
|
|
1104
1104
|
return;
|
|
1105
1105
|
}
|
|
1106
1106
|
|
|
@@ -1572,7 +1572,7 @@ export class FabricText<
|
|
|
1572
1572
|
let boxStart = 0;
|
|
1573
1573
|
let boxWidth = 0;
|
|
1574
1574
|
let lastDecoration = this.getValueOfPropertyAt(i, 0, type);
|
|
1575
|
-
let lastFill = this.getValueOfPropertyAt(i, 0,
|
|
1575
|
+
let lastFill = this.getValueOfPropertyAt(i, 0, FILL);
|
|
1576
1576
|
let currentDecoration;
|
|
1577
1577
|
let currentFill;
|
|
1578
1578
|
const top = topOffset + maxHeight * (1 - this._fontSizeFraction);
|
|
@@ -1581,7 +1581,7 @@ export class FabricText<
|
|
|
1581
1581
|
for (let j = 0, jlen = line.length; j < jlen; j++) {
|
|
1582
1582
|
const charBox = this.__charBounds[i][j] as Required<GraphemeBBox>;
|
|
1583
1583
|
currentDecoration = this.getValueOfPropertyAt(i, j, type);
|
|
1584
|
-
currentFill = this.getValueOfPropertyAt(i, j,
|
|
1584
|
+
currentFill = this.getValueOfPropertyAt(i, j, FILL);
|
|
1585
1585
|
const currentSize = this.getHeightOfChar(i, j);
|
|
1586
1586
|
const currentDy = this.getValueOfPropertyAt(i, j, 'deltaY');
|
|
1587
1587
|
if (path && currentDecoration && currentFill) {
|
|
@@ -8,6 +8,7 @@ import { FabricObjectSVGExportMixin } from '../Object/FabricObjectSVGExportMixin
|
|
|
8
8
|
import { type TextStyleDeclaration } from './StyledText';
|
|
9
9
|
import { JUSTIFY } from '../Text/constants';
|
|
10
10
|
import type { FabricText } from './Text';
|
|
11
|
+
import { STROKE, FILL } from '../../constants';
|
|
11
12
|
|
|
12
13
|
const multipleSpacesRegex = / +/g;
|
|
13
14
|
const dblQuoteRegex = /"/g;
|
|
@@ -326,7 +327,7 @@ export class TextSVGExportMixin extends FabricObjectSVGExportMixin {
|
|
|
326
327
|
const textDecoration = this.getSvgTextDecoration(style);
|
|
327
328
|
|
|
328
329
|
return [
|
|
329
|
-
stroke ? colorPropToSVG(
|
|
330
|
+
stroke ? colorPropToSVG(STROKE, stroke) : '',
|
|
330
331
|
strokeWidth ? `stroke-width: ${strokeWidth}; ` : '',
|
|
331
332
|
fontFamily
|
|
332
333
|
? `font-family: ${
|
|
@@ -339,7 +340,7 @@ export class TextSVGExportMixin extends FabricObjectSVGExportMixin {
|
|
|
339
340
|
fontStyle ? `font-style: ${fontStyle}; ` : '',
|
|
340
341
|
fontWeight ? `font-weight: ${fontWeight}; ` : '',
|
|
341
342
|
textDecoration ? `text-decoration: ${textDecoration}; ` : textDecoration,
|
|
342
|
-
fill ? colorPropToSVG(
|
|
343
|
+
fill ? colorPropToSVG(FILL, fill) : '',
|
|
343
344
|
deltaY ? `baseline-shift: ${-deltaY}; ` : '',
|
|
344
345
|
useWhiteSpace ? 'white-space: pre; ' : '',
|
|
345
346
|
].join('');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LEFT, reNewline } from '../../constants';
|
|
1
|
+
import { FILL, LEFT, STROKE, reNewline } from '../../constants';
|
|
2
2
|
import type { TClassProperties } from '../../typedefs';
|
|
3
3
|
import type { FabricText } from './Text';
|
|
4
4
|
|
|
@@ -52,9 +52,9 @@ export type StylePropertiesType =
|
|
|
52
52
|
export const styleProperties: Readonly<StylePropertiesType[]> = [
|
|
53
53
|
...fontProperties,
|
|
54
54
|
...textDecorationProperties,
|
|
55
|
-
|
|
55
|
+
STROKE,
|
|
56
56
|
'strokeWidth',
|
|
57
|
-
|
|
57
|
+
FILL,
|
|
58
58
|
'deltaY',
|
|
59
59
|
'textBackgroundColor',
|
|
60
60
|
] as const;
|
|
@@ -81,6 +81,7 @@ export type EnlivenObjectOptions = Abortable & {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
+
* @TODO type this correctly.
|
|
84
85
|
* Creates corresponding fabric instances from their object representations
|
|
85
86
|
* @param {Object[]} objects Objects to enliven
|
|
86
87
|
* @param {EnlivenObjectOptions} [options]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Color } from '../../color/Color';
|
|
2
2
|
import { config } from '../../config';
|
|
3
|
-
import { DEFAULT_SVG_FONT_SIZE, NONE } from '../../constants';
|
|
3
|
+
import { DEFAULT_SVG_FONT_SIZE, FILL, NONE } from '../../constants';
|
|
4
4
|
import type {
|
|
5
5
|
TBBox,
|
|
6
6
|
TMat2D,
|
|
@@ -176,7 +176,7 @@ export const createSVGRect = (
|
|
|
176
176
|
{ left, top, width, height }: TBBox,
|
|
177
177
|
precision = config.NUM_FRACTION_DIGITS
|
|
178
178
|
) => {
|
|
179
|
-
const svgColor = colorPropToSVG(
|
|
179
|
+
const svgColor = colorPropToSVG(FILL, color, false);
|
|
180
180
|
const [x, y, w, h] = [left, top, width, height].map((value) =>
|
|
181
181
|
toFixed(value, precision)
|
|
182
182
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CENTER } from '../constants';
|
|
1
|
+
import { CENTER, SCALE_X, SCALE_Y } from '../constants';
|
|
2
2
|
import type { FabricImage } from '../shapes/Image';
|
|
3
3
|
import type { FabricObject } from '../shapes/Object/FabricObject';
|
|
4
4
|
import type { TMat2D } from '../typedefs';
|
|
@@ -23,8 +23,8 @@ const _assignTransformMatrixProps = (
|
|
|
23
23
|
);
|
|
24
24
|
object.flipX = false;
|
|
25
25
|
object.flipY = false;
|
|
26
|
-
object.set(
|
|
27
|
-
object.set(
|
|
26
|
+
object.set(SCALE_X, scaleX);
|
|
27
|
+
object.set(SCALE_Y, scaleY);
|
|
28
28
|
object.angle = angle;
|
|
29
29
|
object.skewX = skewX;
|
|
30
30
|
object.skewY = 0;
|