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.
Files changed (269) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +8 -18
  3. package/dist/fabric.d.ts +4 -0
  4. package/dist/fabric.d.ts.map +1 -1
  5. package/dist/fabric.min.mjs +1 -1
  6. package/dist/fabric.mjs +1 -0
  7. package/dist/fabric.mjs.map +1 -1
  8. package/dist/index.js +146 -107
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.min.js +1 -1
  11. package/dist/index.min.js.map +1 -1
  12. package/dist/index.min.mjs +1 -1
  13. package/dist/index.min.mjs.map +1 -1
  14. package/dist/index.mjs +146 -108
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/index.node.cjs +146 -107
  17. package/dist/index.node.cjs.map +1 -1
  18. package/dist/index.node.mjs +146 -108
  19. package/dist/index.node.mjs.map +1 -1
  20. package/dist/package.json.min.mjs +1 -1
  21. package/dist/package.json.mjs +1 -1
  22. package/dist/src/EventTypeDefs.d.ts +2 -1
  23. package/dist/src/EventTypeDefs.d.ts.map +1 -1
  24. package/dist/src/LayoutManager/LayoutManager.d.ts.map +1 -1
  25. package/dist/src/LayoutManager/LayoutManager.min.mjs +1 -1
  26. package/dist/src/LayoutManager/LayoutManager.min.mjs.map +1 -1
  27. package/dist/src/LayoutManager/LayoutManager.mjs +13 -8
  28. package/dist/src/LayoutManager/LayoutManager.mjs.map +1 -1
  29. package/dist/src/LayoutManager/LayoutStrategies/ClipPathLayout.min.mjs +1 -1
  30. package/dist/src/LayoutManager/LayoutStrategies/ClipPathLayout.min.mjs.map +1 -1
  31. package/dist/src/LayoutManager/LayoutStrategies/ClipPathLayout.mjs +3 -3
  32. package/dist/src/LayoutManager/LayoutStrategies/ClipPathLayout.mjs.map +1 -1
  33. package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.d.ts +1 -1
  34. package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.d.ts.map +1 -1
  35. package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.min.mjs +1 -1
  36. package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.min.mjs.map +1 -1
  37. package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.mjs +15 -9
  38. package/dist/src/LayoutManager/LayoutStrategies/LayoutStrategy.mjs.map +1 -1
  39. package/dist/src/Observable.d.ts +8 -0
  40. package/dist/src/Observable.d.ts.map +1 -1
  41. package/dist/src/Observable.min.mjs.map +1 -1
  42. package/dist/src/Observable.mjs +8 -0
  43. package/dist/src/Observable.mjs.map +1 -1
  44. package/dist/src/canvas/SelectableCanvas.d.ts.map +1 -1
  45. package/dist/src/canvas/SelectableCanvas.min.mjs +1 -1
  46. package/dist/src/canvas/SelectableCanvas.min.mjs.map +1 -1
  47. package/dist/src/canvas/SelectableCanvas.mjs +5 -5
  48. package/dist/src/canvas/SelectableCanvas.mjs.map +1 -1
  49. package/dist/src/canvas/StaticCanvas.d.ts +1 -1
  50. package/dist/src/constants.d.ts +16 -0
  51. package/dist/src/constants.d.ts.map +1 -1
  52. package/dist/src/constants.min.mjs +1 -1
  53. package/dist/src/constants.min.mjs.map +1 -1
  54. package/dist/src/constants.mjs +17 -1
  55. package/dist/src/constants.mjs.map +1 -1
  56. package/dist/src/controls/Control.d.ts.map +1 -1
  57. package/dist/src/controls/Control.min.mjs +1 -1
  58. package/dist/src/controls/Control.min.mjs.map +1 -1
  59. package/dist/src/controls/Control.mjs +2 -1
  60. package/dist/src/controls/Control.mjs.map +1 -1
  61. package/dist/src/controls/changeWidth.min.mjs +1 -1
  62. package/dist/src/controls/changeWidth.min.mjs.map +1 -1
  63. package/dist/src/controls/changeWidth.mjs +2 -2
  64. package/dist/src/controls/changeWidth.mjs.map +1 -1
  65. package/dist/src/controls/commonControls.d.ts.map +1 -1
  66. package/dist/src/controls/commonControls.min.mjs +1 -1
  67. package/dist/src/controls/commonControls.min.mjs.map +1 -1
  68. package/dist/src/controls/commonControls.mjs +4 -3
  69. package/dist/src/controls/commonControls.mjs.map +1 -1
  70. package/dist/src/controls/controlRendering.min.mjs +1 -1
  71. package/dist/src/controls/controlRendering.min.mjs.map +1 -1
  72. package/dist/src/controls/controlRendering.mjs +3 -3
  73. package/dist/src/controls/controlRendering.mjs.map +1 -1
  74. package/dist/src/controls/drag.min.mjs +1 -1
  75. package/dist/src/controls/drag.min.mjs.map +1 -1
  76. package/dist/src/controls/drag.mjs +2 -2
  77. package/dist/src/controls/drag.mjs.map +1 -1
  78. package/dist/src/controls/polyControl.d.ts.map +1 -1
  79. package/dist/src/controls/polyControl.min.mjs +1 -1
  80. package/dist/src/controls/polyControl.min.mjs.map +1 -1
  81. package/dist/src/controls/polyControl.mjs +2 -1
  82. package/dist/src/controls/polyControl.mjs.map +1 -1
  83. package/dist/src/controls/rotate.d.ts.map +1 -1
  84. package/dist/src/controls/rotate.min.mjs +1 -1
  85. package/dist/src/controls/rotate.min.mjs.map +1 -1
  86. package/dist/src/controls/rotate.mjs +2 -1
  87. package/dist/src/controls/rotate.mjs.map +1 -1
  88. package/dist/src/controls/scale.d.ts.map +1 -1
  89. package/dist/src/controls/scale.min.mjs +1 -1
  90. package/dist/src/controls/scale.min.mjs.map +1 -1
  91. package/dist/src/controls/scale.mjs +8 -7
  92. package/dist/src/controls/scale.mjs.map +1 -1
  93. package/dist/src/controls/scaleSkew.d.ts.map +1 -1
  94. package/dist/src/controls/scaleSkew.min.mjs +1 -1
  95. package/dist/src/controls/scaleSkew.min.mjs.map +1 -1
  96. package/dist/src/controls/scaleSkew.mjs +3 -2
  97. package/dist/src/controls/scaleSkew.mjs.map +1 -1
  98. package/dist/src/controls/skew.d.ts.map +1 -1
  99. package/dist/src/controls/skew.min.mjs +1 -1
  100. package/dist/src/controls/skew.min.mjs.map +1 -1
  101. package/dist/src/controls/skew.mjs +7 -7
  102. package/dist/src/controls/skew.mjs.map +1 -1
  103. package/dist/src/filters/Blur.min.mjs +1 -1
  104. package/dist/src/filters/Blur.min.mjs.map +1 -1
  105. package/dist/src/filters/Blur.mjs +1 -1
  106. package/dist/src/filters/Blur.mjs.map +1 -1
  107. package/dist/src/filters/Pixelate.min.mjs +1 -1
  108. package/dist/src/filters/Pixelate.min.mjs.map +1 -1
  109. package/dist/src/filters/Pixelate.mjs +1 -1
  110. package/dist/src/filters/Pixelate.mjs.map +1 -1
  111. package/dist/src/parser/attributes.d.ts.map +1 -1
  112. package/dist/src/parser/attributes.min.mjs +1 -1
  113. package/dist/src/parser/attributes.min.mjs.map +1 -1
  114. package/dist/src/parser/attributes.mjs +3 -1
  115. package/dist/src/parser/attributes.mjs.map +1 -1
  116. package/dist/src/parser/elements_parser.min.mjs +1 -1
  117. package/dist/src/parser/elements_parser.min.mjs.map +1 -1
  118. package/dist/src/parser/elements_parser.mjs +3 -3
  119. package/dist/src/parser/elements_parser.mjs.map +1 -1
  120. package/dist/src/parser/normalizeValue.min.mjs +1 -1
  121. package/dist/src/parser/normalizeValue.min.mjs.map +1 -1
  122. package/dist/src/parser/normalizeValue.mjs +7 -7
  123. package/dist/src/parser/normalizeValue.mjs.map +1 -1
  124. package/dist/src/parser/parseTransformAttribute.min.mjs +1 -1
  125. package/dist/src/parser/parseTransformAttribute.min.mjs.map +1 -1
  126. package/dist/src/parser/parseTransformAttribute.mjs +5 -5
  127. package/dist/src/parser/parseTransformAttribute.mjs.map +1 -1
  128. package/dist/src/shapes/Circle.d.ts.map +1 -1
  129. package/dist/src/shapes/Circle.min.mjs +1 -1
  130. package/dist/src/shapes/Circle.min.mjs.map +1 -1
  131. package/dist/src/shapes/Circle.mjs +3 -2
  132. package/dist/src/shapes/Circle.mjs.map +1 -1
  133. package/dist/src/shapes/Ellipse.min.mjs +1 -1
  134. package/dist/src/shapes/Ellipse.min.mjs.map +1 -1
  135. package/dist/src/shapes/Ellipse.mjs +3 -3
  136. package/dist/src/shapes/Ellipse.mjs.map +1 -1
  137. package/dist/src/shapes/IText/DraggableTextDelegate.min.mjs +1 -1
  138. package/dist/src/shapes/IText/DraggableTextDelegate.min.mjs.map +1 -1
  139. package/dist/src/shapes/IText/DraggableTextDelegate.mjs +3 -3
  140. package/dist/src/shapes/IText/DraggableTextDelegate.mjs.map +1 -1
  141. package/dist/src/shapes/IText/IText.min.mjs +1 -1
  142. package/dist/src/shapes/IText/IText.min.mjs.map +1 -1
  143. package/dist/src/shapes/IText/IText.mjs +3 -3
  144. package/dist/src/shapes/IText/IText.mjs.map +1 -1
  145. package/dist/src/shapes/IText/ITextBehavior.min.mjs +1 -1
  146. package/dist/src/shapes/IText/ITextBehavior.min.mjs.map +1 -1
  147. package/dist/src/shapes/IText/ITextBehavior.mjs +2 -2
  148. package/dist/src/shapes/IText/ITextBehavior.mjs.map +1 -1
  149. package/dist/src/shapes/IText/ITextKeyBehavior.min.mjs +1 -1
  150. package/dist/src/shapes/IText/ITextKeyBehavior.min.mjs.map +1 -1
  151. package/dist/src/shapes/IText/ITextKeyBehavior.mjs +2 -2
  152. package/dist/src/shapes/IText/ITextKeyBehavior.mjs.map +1 -1
  153. package/dist/src/shapes/Image.min.mjs +1 -1
  154. package/dist/src/shapes/Image.min.mjs.map +1 -1
  155. package/dist/src/shapes/Image.mjs +2 -2
  156. package/dist/src/shapes/Image.mjs.map +1 -1
  157. package/dist/src/shapes/Object/AnimatableObject.d.ts.map +1 -1
  158. package/dist/src/shapes/Object/AnimatableObject.min.mjs +1 -1
  159. package/dist/src/shapes/Object/AnimatableObject.min.mjs.map +1 -1
  160. package/dist/src/shapes/Object/AnimatableObject.mjs +2 -1
  161. package/dist/src/shapes/Object/AnimatableObject.mjs.map +1 -1
  162. package/dist/src/shapes/Object/FabricObjectSVGExportMixin.d.ts.map +1 -1
  163. package/dist/src/shapes/Object/FabricObjectSVGExportMixin.min.mjs +1 -1
  164. package/dist/src/shapes/Object/FabricObjectSVGExportMixin.min.mjs.map +1 -1
  165. package/dist/src/shapes/Object/FabricObjectSVGExportMixin.mjs +4 -4
  166. package/dist/src/shapes/Object/FabricObjectSVGExportMixin.mjs.map +1 -1
  167. package/dist/src/shapes/Object/InteractiveObject.d.ts.map +1 -1
  168. package/dist/src/shapes/Object/InteractiveObject.min.mjs +1 -1
  169. package/dist/src/shapes/Object/InteractiveObject.min.mjs.map +1 -1
  170. package/dist/src/shapes/Object/InteractiveObject.mjs +2 -1
  171. package/dist/src/shapes/Object/InteractiveObject.mjs.map +1 -1
  172. package/dist/src/shapes/Object/Object.d.ts +9 -7
  173. package/dist/src/shapes/Object/Object.d.ts.map +1 -1
  174. package/dist/src/shapes/Object/Object.min.mjs +1 -1
  175. package/dist/src/shapes/Object/Object.min.mjs.map +1 -1
  176. package/dist/src/shapes/Object/Object.mjs +14 -12
  177. package/dist/src/shapes/Object/Object.mjs.map +1 -1
  178. package/dist/src/shapes/Object/ObjectGeometry.min.mjs +1 -1
  179. package/dist/src/shapes/Object/ObjectGeometry.min.mjs.map +1 -1
  180. package/dist/src/shapes/Object/ObjectGeometry.mjs +3 -3
  181. package/dist/src/shapes/Object/ObjectGeometry.mjs.map +1 -1
  182. package/dist/src/shapes/Object/defaultValues.d.ts.map +1 -1
  183. package/dist/src/shapes/Object/defaultValues.min.mjs +1 -1
  184. package/dist/src/shapes/Object/defaultValues.min.mjs.map +1 -1
  185. package/dist/src/shapes/Object/defaultValues.mjs +4 -4
  186. package/dist/src/shapes/Object/defaultValues.mjs.map +1 -1
  187. package/dist/src/shapes/Object/types/ControlProps.d.ts +4 -3
  188. package/dist/src/shapes/Object/types/ControlProps.d.ts.map +1 -1
  189. package/dist/src/shapes/Polyline.d.ts.map +1 -1
  190. package/dist/src/shapes/Polyline.min.mjs +1 -1
  191. package/dist/src/shapes/Polyline.min.mjs.map +1 -1
  192. package/dist/src/shapes/Polyline.mjs +3 -3
  193. package/dist/src/shapes/Polyline.mjs.map +1 -1
  194. package/dist/src/shapes/Text/Text.d.ts +2 -2
  195. package/dist/src/shapes/Text/Text.d.ts.map +1 -1
  196. package/dist/src/shapes/Text/Text.min.mjs +1 -1
  197. package/dist/src/shapes/Text/Text.min.mjs.map +1 -1
  198. package/dist/src/shapes/Text/Text.mjs +5 -5
  199. package/dist/src/shapes/Text/Text.mjs.map +1 -1
  200. package/dist/src/shapes/Text/TextSVGExportMixin.d.ts.map +1 -1
  201. package/dist/src/shapes/Text/TextSVGExportMixin.min.mjs +1 -1
  202. package/dist/src/shapes/Text/TextSVGExportMixin.min.mjs.map +1 -1
  203. package/dist/src/shapes/Text/TextSVGExportMixin.mjs +2 -1
  204. package/dist/src/shapes/Text/TextSVGExportMixin.mjs.map +1 -1
  205. package/dist/src/shapes/Text/constants.min.mjs +1 -1
  206. package/dist/src/shapes/Text/constants.min.mjs.map +1 -1
  207. package/dist/src/shapes/Text/constants.mjs +2 -2
  208. package/dist/src/shapes/Text/constants.mjs.map +1 -1
  209. package/dist/src/util/misc/objectEnlive.d.ts +1 -0
  210. package/dist/src/util/misc/objectEnlive.d.ts.map +1 -1
  211. package/dist/src/util/misc/objectEnlive.min.mjs.map +1 -1
  212. package/dist/src/util/misc/objectEnlive.mjs +1 -0
  213. package/dist/src/util/misc/objectEnlive.mjs.map +1 -1
  214. package/dist/src/util/misc/svgParsing.min.mjs +1 -1
  215. package/dist/src/util/misc/svgParsing.min.mjs.map +1 -1
  216. package/dist/src/util/misc/svgParsing.mjs +2 -2
  217. package/dist/src/util/misc/svgParsing.mjs.map +1 -1
  218. package/dist/src/util/transform_matrix_removal.min.mjs +1 -1
  219. package/dist/src/util/transform_matrix_removal.min.mjs.map +1 -1
  220. package/dist/src/util/transform_matrix_removal.mjs +3 -3
  221. package/dist/src/util/transform_matrix_removal.mjs.map +1 -1
  222. package/fabric.ts +4 -0
  223. package/package.json +1 -1
  224. package/src/EventTypeDefs.ts +14 -6
  225. package/src/LayoutManager/LayoutManager.ts +28 -19
  226. package/src/LayoutManager/LayoutStrategies/ClipPathLayout.ts +2 -2
  227. package/src/LayoutManager/LayoutStrategies/LayoutStrategy.ts +7 -7
  228. package/src/Observable.ts +8 -0
  229. package/src/canvas/SelectableCanvas.ts +25 -11
  230. package/src/canvas/canvas_gestures.mixin.ts +6 -5
  231. package/src/constants.ts +17 -0
  232. package/src/controls/Control.ts +2 -1
  233. package/src/controls/changeWidth.ts +2 -2
  234. package/src/controls/commonControls.ts +4 -3
  235. package/src/controls/controlRendering.ts +3 -3
  236. package/src/controls/drag.ts +2 -2
  237. package/src/controls/polyControl.ts +2 -1
  238. package/src/controls/rotate.ts +2 -1
  239. package/src/controls/scale.ts +8 -7
  240. package/src/controls/scaleSkew.ts +3 -2
  241. package/src/controls/skew.ts +14 -7
  242. package/src/filters/Blur.ts +1 -1
  243. package/src/filters/Pixelate.ts +1 -1
  244. package/src/parser/attributes.ts +4 -2
  245. package/src/parser/elements_parser.ts +3 -3
  246. package/src/parser/normalizeValue.ts +7 -7
  247. package/src/parser/parseTransformAttribute.ts +5 -5
  248. package/src/shapes/Circle.ts +3 -2
  249. package/src/shapes/Ellipse.ts +3 -3
  250. package/src/shapes/IText/DraggableTextDelegate.ts +3 -3
  251. package/src/shapes/IText/IText.ts +3 -3
  252. package/src/shapes/IText/ITextBehavior.ts +2 -2
  253. package/src/shapes/IText/ITextKeyBehavior.ts +2 -2
  254. package/src/shapes/Image.ts +2 -2
  255. package/src/shapes/Object/AnimatableObject.ts +2 -1
  256. package/src/shapes/Object/FabricObjectSVGExportMixin.ts +4 -6
  257. package/src/shapes/Object/InteractiveObject.ts +2 -1
  258. package/src/shapes/Object/Object.ts +16 -11
  259. package/src/shapes/Object/ObjectGeometry.ts +3 -3
  260. package/src/shapes/Object/defaultValues.ts +17 -8
  261. package/src/shapes/Object/types/ControlProps.ts +4 -3
  262. package/src/shapes/Polyline.spec.ts +0 -1
  263. package/src/shapes/Polyline.ts +12 -4
  264. package/src/shapes/Text/Text.ts +7 -7
  265. package/src/shapes/Text/TextSVGExportMixin.ts +3 -2
  266. package/src/shapes/Text/constants.ts +3 -3
  267. package/src/util/misc/objectEnlive.ts +1 -0
  268. package/src/util/misc/svgParsing.ts +2 -2
  269. package/src/util/transform_matrix_removal.ts +3 -3
package/dist/index.js CHANGED
@@ -407,7 +407,7 @@
407
407
  }
408
408
  const cache = new Cache();
409
409
 
410
- var version = "6.0.0";
410
+ var version = "6.0.2";
411
411
 
412
412
  // use this syntax so babel plugin see this import here
413
413
  const VERSION = version;
@@ -429,6 +429,22 @@
429
429
  const RIGHT = 'right';
430
430
  const NONE = 'none';
431
431
  const reNewline = /\r?\n/;
432
+ const MOVING = 'moving';
433
+ const SCALING = 'scaling';
434
+ const ROTATING = 'rotating';
435
+ const ROTATE = 'rotate';
436
+ const SKEWING = 'skewing';
437
+ const RESIZING = 'resizing';
438
+ const MODIFY_POLY = 'modifyPoly';
439
+ const CHANGED = 'changed';
440
+ const SCALE = 'scale';
441
+ const SCALE_X = 'scaleX';
442
+ const SCALE_Y = 'scaleY';
443
+ const SKEW_X = 'skewX';
444
+ const SKEW_Y = 'skewY';
445
+ const FILL = 'fill';
446
+ const STROKE = 'stroke';
447
+ const MODIFIED = 'modified';
432
448
 
433
449
  /*
434
450
  * This Map connects the objects type value with their
@@ -619,6 +635,14 @@
619
635
  }
620
636
  }
621
637
 
638
+ /**
639
+ * Unsubscribe all event listeners for eventname.
640
+ * Do not use this pattern. You could kill internal fabricJS events.
641
+ * We know we should have protected events for internal flows, but we don't have yet
642
+ * @deprecated
643
+ * @param {string} eventName event name (eg. 'after:render')
644
+ */
645
+
622
646
  /**
623
647
  * unsubscribe an event listener
624
648
  * @param {string} eventName event name (eg. 'after:render')
@@ -1877,6 +1901,7 @@
1877
1901
  });
1878
1902
  };
1879
1903
  /**
1904
+ * @TODO type this correctly.
1880
1905
  * Creates corresponding fabric instances from their object representations
1881
1906
  * @param {Object[]} objects Objects to enliven
1882
1907
  * @param {EnlivenObjectOptions} [options]
@@ -2787,7 +2812,7 @@
2787
2812
  height
2788
2813
  } = _ref;
2789
2814
  let precision = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : config.NUM_FRACTION_DIGITS;
2790
- const svgColor = colorPropToSVG('fill', color, false);
2815
+ const svgColor = colorPropToSVG(FILL, color, false);
2791
2816
  const [x, y, w, h] = [left, top, width, height].map(value => toFixed(value, precision));
2792
2817
  return "<rect ".concat(svgColor, " x=\"").concat(x, "\" y=\"").concat(y, "\" width=\"").concat(w, "\" height=\"").concat(h, "\"></rect>");
2793
2818
  };
@@ -4689,7 +4714,7 @@
4689
4714
  moveX && target.set(LEFT, newLeft);
4690
4715
  moveY && target.set(TOP, newTop);
4691
4716
  if (moveX || moveY) {
4692
- fireEvent('moving', commonEventInfo(eventData, transform, x, y));
4717
+ fireEvent(MOVING, commonEventInfo(eventData, transform, x, y));
4693
4718
  }
4694
4719
  return moveX || moveY;
4695
4720
  };
@@ -4717,8 +4742,8 @@
4717
4742
  opacity = typeof this.opacity !== 'undefined' ? this.opacity : '1',
4718
4743
  visibility = this.visible ? '' : ' visibility: hidden;',
4719
4744
  filter = skipShadow ? '' : this.getSvgFilter(),
4720
- fill = colorPropToSVG('fill', this.fill),
4721
- stroke = colorPropToSVG('stroke', this.stroke);
4745
+ fill = colorPropToSVG(FILL, this.fill),
4746
+ stroke = colorPropToSVG(STROKE, this.stroke);
4722
4747
  return [stroke, 'stroke-width: ', strokeWidth, '; ', 'stroke-dasharray: ', strokeDashArray, '; ', 'stroke-linecap: ', strokeLineCap, '; ', 'stroke-dashoffset: ', strokeDashOffset, '; ', 'stroke-linejoin: ', strokeLineJoin, '; ', 'stroke-miterlimit: ', strokeMiterLimit, '; ', fill, 'fill-rule: ', fillRule, '; ', 'opacity: ', opacity, ';', filter, visibility].join('');
4723
4748
  }
4724
4749
 
@@ -4848,7 +4873,7 @@
4848
4873
  return reviver ? reviver(markup.join('')) : markup.join('');
4849
4874
  }
4850
4875
  addPaintOrder() {
4851
- return this.paintFirst !== 'fill' ? " paint-order=\"".concat(this.paintFirst, "\" ") : '';
4876
+ return this.paintFirst !== FILL ? " paint-order=\"".concat(this.paintFirst, "\" ") : '';
4852
4877
  }
4853
4878
  }
4854
4879
 
@@ -6236,8 +6261,8 @@
6236
6261
  * @return {void}
6237
6262
  */
6238
6263
  scale(value) {
6239
- this._set('scaleX', value);
6240
- this._set('scaleY', value);
6264
+ this._set(SCALE_X, value);
6265
+ this._set(SCALE_Y, value);
6241
6266
  this.setCoords();
6242
6267
  }
6243
6268
 
@@ -6624,7 +6649,7 @@
6624
6649
  * List of properties to consider for animating colors.
6625
6650
  * @type String[]
6626
6651
  */
6627
- _defineProperty(AnimatableObject, "colorProperties", ['fill', 'stroke', 'backgroundColor']);
6652
+ _defineProperty(AnimatableObject, "colorProperties", [FILL, STROKE, 'backgroundColor']);
6628
6653
 
6629
6654
  function getSvgRegex(arr) {
6630
6655
  return new RegExp('^(' + arr.join('|') + ')\\b', 'i');
@@ -6840,8 +6865,8 @@
6840
6865
 
6841
6866
  const cloneDeep = object => JSON.parse(JSON.stringify(object));
6842
6867
 
6843
- const stateProperties = [TOP, LEFT, 'scaleX', 'scaleY', 'flipX', 'flipY', 'originX', 'originY', 'angle', 'opacity', 'globalCompositeOperation', 'shadow', 'visible', 'skewX', 'skewY'];
6844
- const cacheProperties = ['fill', 'stroke', 'strokeWidth', 'strokeDashArray', 'width', 'height', 'paintFirst', 'strokeUniform', 'strokeLineCap', 'strokeDashOffset', 'strokeLineJoin', 'strokeMiterLimit', 'backgroundColor', 'clipPath'];
6868
+ const stateProperties = [TOP, LEFT, SCALE_X, SCALE_Y, 'flipX', 'flipY', 'originX', 'originY', 'angle', 'opacity', 'globalCompositeOperation', 'shadow', 'visible', SKEW_X, SKEW_Y];
6869
+ const cacheProperties = [FILL, STROKE, 'strokeWidth', 'strokeDashArray', 'width', 'height', 'paintFirst', 'strokeUniform', 'strokeLineCap', 'strokeDashOffset', 'strokeLineJoin', 'strokeMiterLimit', 'backgroundColor', 'clipPath'];
6845
6870
  const fabricObjectDefaultValues = {
6846
6871
  // see composeMatrix() to see order of transforms. First defaults listed based on this
6847
6872
  top: 0,
@@ -6862,7 +6887,7 @@
6862
6887
  strokeUniform: false,
6863
6888
  padding: 0,
6864
6889
  opacity: 1,
6865
- paintFirst: 'fill',
6890
+ paintFirst: FILL,
6866
6891
  fill: 'rgb(0,0,0)',
6867
6892
  fillRule: 'nonzero',
6868
6893
  stroke: null,
@@ -6953,18 +6978,20 @@
6953
6978
  }
6954
6979
 
6955
6980
  /**
6956
- * The class type. Used to identify which class this is.
6957
- * This is used for serialization purposes and internally it can be used
6958
- * to identify classes. As a developer you could use `instance of Class`
6959
- * but to avoid importing all the code and blocking tree shaking we try
6960
- * to avoid doing that.
6981
+ * The class type.
6982
+ * This is used for serialization and deserialization purposes and internally it can be used
6983
+ * to identify classes.
6984
+ * When we transform a class in a plain JS object we need a way to recognize which class it was,
6985
+ * and the type is the way we do that. It has no other purposes and you should not give one.
6986
+ * Hard to reach on instances and please do not use to drive instance's logic (this.constructor.type).
6987
+ * To idenfity a class use instanceof class ( instanceof Rect ).
6988
+ * We do not do that in fabricJS code because we want to try to have code splitting possible.
6961
6989
  */
6962
6990
 
6963
6991
  /**
6964
6992
  * Legacy identifier of the class. Prefer using utils like isType or instanceOf
6965
6993
  * Will be removed in fabric 7 or 8.
6966
- * The setter exists because is very hard to catch all the ways in which a type value
6967
- * could be set in the instance
6994
+ * The setter exists to avoid type errors in old code and possibly current deserialization code.
6968
6995
  * @TODO add sustainable warning message
6969
6996
  * @type string
6970
6997
  * @deprecated
@@ -7335,10 +7362,10 @@
7335
7362
  * @param {*} value
7336
7363
  */
7337
7364
  _set(key, value) {
7338
- if (key === 'scaleX' || key === 'scaleY') {
7365
+ if (key === SCALE_X || key === SCALE_Y) {
7339
7366
  value = this._constrainScale(value);
7340
7367
  }
7341
- if (key === 'scaleX' && value < 0) {
7368
+ if (key === SCALE_X && value < 0) {
7342
7369
  this.flipX = !this.flipX;
7343
7370
  value *= -1;
7344
7371
  } else if (key === 'scaleY' && value < 0) {
@@ -7459,7 +7486,7 @@
7459
7486
  * @returns Boolean
7460
7487
  */
7461
7488
  needsItsOwnCache() {
7462
- if (this.paintFirst === 'stroke' && this.hasFill() && this.hasStroke() && !!this.shadow) {
7489
+ if (this.paintFirst === STROKE && this.hasFill() && this.hasStroke() && !!this.shadow) {
7463
7490
  return true;
7464
7491
  }
7465
7492
  if (this.clipPath) {
@@ -7754,7 +7781,7 @@
7754
7781
  * @param {CanvasRenderingContext2D} ctx Context to render on
7755
7782
  */
7756
7783
  _renderPaintInOrder(ctx) {
7757
- if (this.paintFirst === 'stroke') {
7784
+ if (this.paintFirst === STROKE) {
7758
7785
  this._renderStroke(ctx);
7759
7786
  this._renderFill(ctx);
7760
7787
  } else {
@@ -8231,7 +8258,7 @@
8231
8258
  }
8232
8259
  return false;
8233
8260
  };
8234
- const changeWidth = wrapWithFireEvent('resizing', wrapWithFixedAnchor(changeObjectWidth));
8261
+ const changeWidth = wrapWithFireEvent(RESIZING, wrapWithFixedAnchor(changeObjectWidth));
8235
8262
 
8236
8263
  /**
8237
8264
  * Render a round control, as per fabric features.
@@ -8249,7 +8276,7 @@
8249
8276
  const xSize = this.sizeX || styleOverride.cornerSize || fabricObject.cornerSize,
8250
8277
  ySize = this.sizeY || styleOverride.cornerSize || fabricObject.cornerSize,
8251
8278
  transparentCorners = typeof styleOverride.transparentCorners !== 'undefined' ? styleOverride.transparentCorners : fabricObject.transparentCorners,
8252
- methodName = transparentCorners ? 'stroke' : 'fill',
8279
+ methodName = transparentCorners ? STROKE : FILL,
8253
8280
  stroke = !transparentCorners && (styleOverride.cornerStrokeColor || fabricObject.cornerStrokeColor);
8254
8281
  let myLeft = left,
8255
8282
  myTop = top,
@@ -8296,7 +8323,7 @@
8296
8323
  const xSize = this.sizeX || styleOverride.cornerSize || fabricObject.cornerSize,
8297
8324
  ySize = this.sizeY || styleOverride.cornerSize || fabricObject.cornerSize,
8298
8325
  transparentCorners = typeof styleOverride.transparentCorners !== 'undefined' ? styleOverride.transparentCorners : fabricObject.transparentCorners,
8299
- methodName = transparentCorners ? 'stroke' : 'fill',
8326
+ methodName = transparentCorners ? STROKE : FILL,
8300
8327
  stroke = !transparentCorners && (styleOverride.cornerStrokeColor || fabricObject.cornerStrokeColor),
8301
8328
  xSizeBy2 = xSize / 2,
8302
8329
  ySizeBy2 = ySize / 2;
@@ -8341,7 +8368,7 @@
8341
8368
  * @type {String}
8342
8369
  * @default 'scale'
8343
8370
  */
8344
- _defineProperty(this, "actionName", 'scale');
8371
+ _defineProperty(this, "actionName", SCALE);
8345
8372
  /**
8346
8373
  * Drawing angle of the control.
8347
8374
  * NOT used for now, but name marked as needed for internal logic
@@ -8659,7 +8686,7 @@
8659
8686
  target.angle = angle;
8660
8687
  return hasRotated;
8661
8688
  };
8662
- const rotationWithSnapping = wrapWithFireEvent('rotating', wrapWithFixedAnchor(rotateObjectWithSnapping));
8689
+ const rotationWithSnapping = wrapWithFireEvent(ROTATING, wrapWithFixedAnchor(rotateObjectWithSnapping));
8663
8690
 
8664
8691
  /**
8665
8692
  * Inspect event and fabricObject properties to understand if the scaling action
@@ -8808,12 +8835,12 @@
8808
8835
  const oldScaleX = target.scaleX,
8809
8836
  oldScaleY = target.scaleY;
8810
8837
  if (!by) {
8811
- !isLocked(target, 'lockScalingX') && target.set('scaleX', scaleX);
8812
- !isLocked(target, 'lockScalingY') && target.set('scaleY', scaleY);
8838
+ !isLocked(target, 'lockScalingX') && target.set(SCALE_X, scaleX);
8839
+ !isLocked(target, 'lockScalingY') && target.set(SCALE_Y, scaleY);
8813
8840
  } else {
8814
8841
  // forbidden cases already handled on top here.
8815
- by === 'x' && target.set('scaleX', scaleX);
8816
- by === 'y' && target.set('scaleY', scaleY);
8842
+ by === 'x' && target.set(SCALE_X, scaleX);
8843
+ by === 'y' && target.set(SCALE_Y, scaleY);
8817
8844
  }
8818
8845
  return oldScaleX !== target.scaleX || oldScaleY !== target.scaleY;
8819
8846
  }
@@ -8860,24 +8887,24 @@
8860
8887
  by: 'y'
8861
8888
  });
8862
8889
  };
8863
- const scalingEqually = wrapWithFireEvent('scaling', wrapWithFixedAnchor(scaleObjectFromCorner));
8864
- const scalingX = wrapWithFireEvent('scaling', wrapWithFixedAnchor(scaleObjectX));
8865
- const scalingY = wrapWithFireEvent('scaling', wrapWithFixedAnchor(scaleObjectY));
8890
+ const scalingEqually = wrapWithFireEvent(SCALING, wrapWithFixedAnchor(scaleObjectFromCorner));
8891
+ const scalingX = wrapWithFireEvent(SCALING, wrapWithFixedAnchor(scaleObjectX));
8892
+ const scalingY = wrapWithFireEvent(SCALING, wrapWithFixedAnchor(scaleObjectY));
8866
8893
 
8867
8894
  const _excluded$d = ["target", "ex", "ey", "skewingSide"];
8868
8895
  const AXIS_KEYS = {
8869
8896
  x: {
8870
8897
  counterAxis: 'y',
8871
- scale: 'scaleX',
8872
- skew: 'skewX',
8898
+ scale: SCALE_X,
8899
+ skew: SKEW_X,
8873
8900
  lockSkewing: 'lockSkewingX',
8874
8901
  origin: 'originX',
8875
8902
  flip: 'flipX'
8876
8903
  },
8877
8904
  y: {
8878
8905
  counterAxis: 'x',
8879
- scale: 'scaleY',
8880
- skew: 'skewY',
8906
+ scale: SCALE_Y,
8907
+ skew: SKEW_Y,
8881
8908
  lockSkewing: 'lockSkewingY',
8882
8909
  origin: 'originY',
8883
8910
  flip: 'flipY'
@@ -8956,7 +8983,7 @@
8956
8983
  }),
8957
8984
  dimAfter = target._getTransformedDimensions(),
8958
8985
  compensationFactor = skewX !== 0 ? dimBefore.x / dimAfter.x : 1;
8959
- compensationFactor !== 1 && target.set('scaleX', compensationFactor * scaleX);
8986
+ compensationFactor !== 1 && target.set(SCALE_X, compensationFactor * scaleX);
8960
8987
  }
8961
8988
  return changed;
8962
8989
  }
@@ -9002,7 +9029,7 @@
9002
9029
  // anchor to the opposite side of the skewing direction
9003
9030
  // normalize value from [-1, 1] to origin value [0, 1]
9004
9031
  origin = -skewingDirection * 0.5 + 0.5;
9005
- const finalHandler = wrapWithFireEvent('skewing', wrapWithFixedAnchor((eventData, transform, x, y) => skewObject(axis, transform, new Point(x, y))));
9032
+ const finalHandler = wrapWithFireEvent(SKEWING, wrapWithFixedAnchor((eventData, transform, x, y) => skewObject(axis, transform, new Point(x, y))));
9006
9033
  return finalHandler(eventData, _objectSpread2(_objectSpread2({}, transform), {}, {
9007
9034
  [originKey]: origin,
9008
9035
  skewingSide
@@ -9050,11 +9077,11 @@
9050
9077
  const isAlternative = isAltAction(eventData, fabricObject);
9051
9078
  if (control.x === 0) {
9052
9079
  // then is scaleY or skewX
9053
- return isAlternative ? 'skewX' : 'scaleY';
9080
+ return isAlternative ? SKEW_X : SCALE_Y;
9054
9081
  }
9055
9082
  if (control.y === 0) {
9056
9083
  // then is scaleY or skewX
9057
- return isAlternative ? 'skewY' : 'scaleX';
9084
+ return isAlternative ? SKEW_Y : SCALE_X;
9058
9085
  }
9059
9086
  return '';
9060
9087
  };
@@ -9156,7 +9183,7 @@
9156
9183
  cursorStyleHandler: rotationStyleHandler,
9157
9184
  offsetY: -40,
9158
9185
  withConnection: true,
9159
- actionName: 'rotate'
9186
+ actionName: ROTATE
9160
9187
  })
9161
9188
  });
9162
9189
  const createResizeControls = () => ({
@@ -9165,14 +9192,14 @@
9165
9192
  y: 0,
9166
9193
  actionHandler: changeWidth,
9167
9194
  cursorStyleHandler: scaleSkewCursorStyleHandler,
9168
- actionName: 'resizing'
9195
+ actionName: RESIZING
9169
9196
  }),
9170
9197
  ml: new Control({
9171
9198
  x: -0.5,
9172
9199
  y: 0,
9173
9200
  actionHandler: changeWidth,
9174
9201
  cursorStyleHandler: scaleSkewCursorStyleHandler,
9175
- actionName: 'resizing'
9202
+ actionName: RESIZING
9176
9203
  })
9177
9204
  });
9178
9205
  const createTextboxDefaultControls = () => _objectSpread2(_objectSpread2({}, createObjectDefaultControls()), createResizeControls());
@@ -9216,7 +9243,7 @@
9216
9243
  const transform = targetCanvas._currentTransform,
9217
9244
  target = transform.target,
9218
9245
  action = transform.action;
9219
- if (this === target && action && action.startsWith('scale')) {
9246
+ if (this === target && action && action.startsWith(SCALE)) {
9220
9247
  return false;
9221
9248
  }
9222
9249
  }
@@ -10372,7 +10399,7 @@
10372
10399
  * Attributes parsed from all SVG elements
10373
10400
  * @type array
10374
10401
  */
10375
- const SHARED_ATTRIBUTES = ['display', 'transform', 'fill', 'fill-opacity', 'fill-rule', 'opacity', 'stroke', 'stroke-dasharray', 'stroke-linecap', 'stroke-dashoffset', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'id', 'paint-order', 'vector-effect', 'instantiated_by_use', 'clip-path'];
10402
+ const SHARED_ATTRIBUTES = ['display', 'transform', FILL, 'fill-opacity', 'fill-rule', 'opacity', STROKE, 'stroke-dasharray', 'stroke-linecap', 'stroke-dashoffset', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'id', 'paint-order', 'vector-effect', 'instantiated_by_use', 'clip-path'];
10376
10403
 
10377
10404
  function selectorMatches(element, selector) {
10378
10405
  const nodeName = element.nodeName;
@@ -10504,7 +10531,7 @@
10504
10531
  case 'translate':
10505
10532
  matrix = createTranslateMatrix(arg0, arg1);
10506
10533
  break;
10507
- case 'rotate':
10534
+ case ROTATE:
10508
10535
  matrix = createRotateMatrix({
10509
10536
  angle: arg0
10510
10537
  }, {
@@ -10512,13 +10539,13 @@
10512
10539
  y: arg2
10513
10540
  });
10514
10541
  break;
10515
- case 'scale':
10542
+ case SCALE:
10516
10543
  matrix = createScaleMatrix(arg0, arg1);
10517
10544
  break;
10518
- case 'skewX':
10545
+ case SKEW_X:
10519
10546
  matrix = createSkewXMatrix(arg0);
10520
10547
  break;
10521
- case 'skewY':
10548
+ case SKEW_Y:
10522
10549
  matrix = createSkewYMatrix(arg0);
10523
10550
  break;
10524
10551
  case 'matrix':
@@ -10536,7 +10563,7 @@
10536
10563
  const isArray = Array.isArray(value);
10537
10564
  let parsed;
10538
10565
  let ouputValue = value;
10539
- if ((attr === 'fill' || attr === 'stroke') && value === NONE) {
10566
+ if ((attr === FILL || attr === STROKE) && value === NONE) {
10540
10567
  ouputValue = '';
10541
10568
  } else if (attr === 'strokeUniform') {
10542
10569
  return value === 'non-scaling-stroke';
@@ -10569,13 +10596,13 @@
10569
10596
  // parseUnit returns px and we convert it to em
10570
10597
  parsed = parseUnit(value, fontSize) / fontSize * 1000;
10571
10598
  } else if (attr === 'paintFirst') {
10572
- const fillIndex = value.indexOf('fill');
10573
- const strokeIndex = value.indexOf('stroke');
10574
- ouputValue = 'fill';
10599
+ const fillIndex = value.indexOf(FILL);
10600
+ const strokeIndex = value.indexOf(STROKE);
10601
+ ouputValue = FILL;
10575
10602
  if (fillIndex > -1 && strokeIndex > -1 && strokeIndex < fillIndex) {
10576
- ouputValue = 'stroke';
10603
+ ouputValue = STROKE;
10577
10604
  } else if (fillIndex === -1 && strokeIndex > -1) {
10578
- ouputValue = 'stroke';
10605
+ ouputValue = STROKE;
10579
10606
  }
10580
10607
  } else if (attr === 'href' || attr === 'xlink:href' || attr === 'font') {
10581
10608
  return value;
@@ -10949,16 +10976,21 @@
10949
10976
  return this.calcBoundingBox(objects, context);
10950
10977
  }
10951
10978
  }
10952
- shouldPerformLayout(context) {
10953
- return context.type === LAYOUT_TYPE_INITIALIZATION || context.type === LAYOUT_TYPE_IMPERATIVE || !!context.prevStrategy && context.strategy !== context.prevStrategy;
10979
+ shouldPerformLayout(_ref) {
10980
+ let {
10981
+ type,
10982
+ prevStrategy,
10983
+ strategy
10984
+ } = _ref;
10985
+ return type === LAYOUT_TYPE_INITIALIZATION || type === LAYOUT_TYPE_IMPERATIVE || !!prevStrategy && strategy !== prevStrategy;
10954
10986
  }
10955
- shouldLayoutClipPath(_ref) {
10987
+ shouldLayoutClipPath(_ref2) {
10956
10988
  let {
10957
10989
  type,
10958
10990
  target: {
10959
10991
  clipPath
10960
10992
  }
10961
- } = _ref;
10993
+ } = _ref2;
10962
10994
  return type !== LAYOUT_TYPE_INITIALIZATION && clipPath && !clipPath.absolutePositioned;
10963
10995
  }
10964
10996
  getInitialSize(context, result) {
@@ -10969,15 +11001,16 @@
10969
11001
  * Override this method to customize layout.
10970
11002
  */
10971
11003
  calcBoundingBox(objects, context) {
10972
- if (context.type === LAYOUT_TYPE_IMPERATIVE && context.overrides) {
11004
+ const {
11005
+ type,
11006
+ target
11007
+ } = context;
11008
+ if (type === LAYOUT_TYPE_IMPERATIVE && context.overrides) {
10973
11009
  return context.overrides;
10974
11010
  }
10975
11011
  if (objects.length === 0) {
10976
11012
  return;
10977
11013
  }
10978
- const {
10979
- target
10980
- } = context;
10981
11014
  const {
10982
11015
  left,
10983
11016
  top,
@@ -10987,7 +11020,7 @@
10987
11020
  const bboxSize = new Point(width, height);
10988
11021
  const bboxLeftTop = new Point(left, top);
10989
11022
  const bboxCenter = bboxLeftTop.add(bboxSize.scalarDivide(2));
10990
- if (context.type === LAYOUT_TYPE_INITIALIZATION) {
11023
+ if (type === LAYOUT_TYPE_INITIALIZATION) {
10991
11024
  const actualSize = this.getInitialSize(context, {
10992
11025
  size: bboxSize,
10993
11026
  center: bboxCenter
@@ -11071,7 +11104,7 @@
11071
11104
  const {
11072
11105
  target
11073
11106
  } = context;
11074
- return ['modified', 'moving', 'resizing', 'rotating', 'scaling', 'skewing', 'changed', 'modifyPoly'].map(key => object.on(key, e => this.performLayout(key === 'modified' ? {
11107
+ return [MODIFIED, MOVING, RESIZING, ROTATING, SCALING, SKEWING, CHANGED, MODIFY_POLY].map(key => object.on(key, e => this.performLayout(key === MODIFIED ? {
11075
11108
  type: LAYOUT_TYPE_OBJECT_MODIFIED,
11076
11109
  trigger: key,
11077
11110
  e,
@@ -11143,13 +11176,15 @@
11143
11176
  }
11144
11177
  getLayoutResult(context) {
11145
11178
  const {
11146
- target
11179
+ target,
11180
+ strategy,
11181
+ type
11147
11182
  } = context;
11148
- const result = context.strategy.calcLayoutResult(context, target.getObjects());
11183
+ const result = strategy.calcLayoutResult(context, target.getObjects());
11149
11184
  if (!result) {
11150
11185
  return;
11151
11186
  }
11152
- const prevCenter = context.type === LAYOUT_TYPE_INITIALIZATION ? new Point() : target.getRelativeCenterPoint();
11187
+ const prevCenter = type === LAYOUT_TYPE_INITIALIZATION ? new Point() : target.getRelativeCenterPoint();
11153
11188
  const {
11154
11189
  center: nextCenter,
11155
11190
  correction = new Point(),
@@ -11157,7 +11192,7 @@
11157
11192
  } = result;
11158
11193
  const offset = prevCenter.subtract(nextCenter).add(correction).transform(
11159
11194
  // in `initialization` we do not account for target's transformation matrix
11160
- context.type === LAYOUT_TYPE_INITIALIZATION ? iMatrix : invertTransform(target.calcOwnMatrix()), true).add(relativeCorrection);
11195
+ type === LAYOUT_TYPE_INITIALIZATION ? iMatrix : invertTransform(target.calcOwnMatrix()), true).add(relativeCorrection);
11161
11196
  return {
11162
11197
  result,
11163
11198
  prevCenter,
@@ -11262,8 +11297,11 @@
11262
11297
  target.set('dirty', true);
11263
11298
  }
11264
11299
  dispose() {
11265
- this._subscriptions.forEach(disposers => disposers.forEach(d => d()));
11266
- this._subscriptions.clear();
11300
+ const {
11301
+ _subscriptions
11302
+ } = this;
11303
+ _subscriptions.forEach(disposers => disposers.forEach(d => d()));
11304
+ _subscriptions.clear();
11267
11305
  }
11268
11306
  toObject() {
11269
11307
  return {
@@ -12821,8 +12859,8 @@
12821
12859
  } = qrDecompose(object.transformMatrix);
12822
12860
  object.flipX = false;
12823
12861
  object.flipY = false;
12824
- object.set('scaleX', scaleX);
12825
- object.set('scaleY', scaleY);
12862
+ object.set(SCALE_X, scaleX);
12863
+ object.set(SCALE_Y, scaleY);
12826
12864
  object.angle = angle;
12827
12865
  object.skewX = skewX;
12828
12866
  object.skewY = 0;
@@ -13446,9 +13484,9 @@
13446
13484
  return;
13447
13485
  }
13448
13486
  let centerTransform;
13449
- if (action === 'scale' || action === 'scaleX' || action === 'scaleY' || action === 'resizing') {
13487
+ if (action === SCALE || action === SCALE_X || action === SCALE_Y || action === RESIZING) {
13450
13488
  centerTransform = this.centeredScaling || target.centeredScaling;
13451
- } else if (action === 'rotate') {
13489
+ } else if (action === ROTATE) {
13452
13490
  centerTransform = this.centeredRotation || target.centeredRotation;
13453
13491
  }
13454
13492
  return centerTransform ? !modifierKeyPressed : modifierKeyPressed;
@@ -14077,7 +14115,7 @@
14077
14115
  target.setCoords();
14078
14116
  if (transform.actionPerformed) {
14079
14117
  this.fire('object:modified', options);
14080
- target.fire('modified', options);
14118
+ target.fire(MODIFIED, options);
14081
14119
  }
14082
14120
  }
14083
14121
 
@@ -14164,7 +14202,7 @@
14164
14202
  group
14165
14203
  } = instance;
14166
14204
  if (group && isActiveSelection(group) && this._activeObject === group) {
14167
- const layoutProps = ['angle', 'flipX', 'flipY', LEFT, 'scaleX', 'scaleY', 'skewX', 'skewY', TOP];
14205
+ const layoutProps = ['angle', 'flipX', 'flipY', LEFT, SCALE_X, SCALE_Y, SKEW_X, SKEW_Y, TOP];
14168
14206
  const originalValues = pick(instance, layoutProps);
14169
14207
  addTransformToObject(instance, group.calcOwnMatrix());
14170
14208
  return originalValues;
@@ -16894,7 +16932,7 @@
16894
16932
  * @return {Number}
16895
16933
  */
16896
16934
  getRadiusX() {
16897
- return this.get('radius') * this.get('scaleX');
16935
+ return this.get('radius') * this.get(SCALE_X);
16898
16936
  }
16899
16937
 
16900
16938
  /**
@@ -16902,7 +16940,7 @@
16902
16940
  * @return {Number}
16903
16941
  */
16904
16942
  getRadiusY() {
16905
- return this.get('radius') * this.get('scaleY');
16943
+ return this.get('radius') * this.get(SCALE_Y);
16906
16944
  }
16907
16945
 
16908
16946
  /**
@@ -17723,7 +17761,7 @@
17723
17761
  * @return {Number}
17724
17762
  */
17725
17763
  getRx() {
17726
- return this.get('rx') * this.get('scaleX');
17764
+ return this.get('rx') * this.get(SCALE_X);
17727
17765
  }
17728
17766
 
17729
17767
  /**
@@ -17731,7 +17769,7 @@
17731
17769
  * @return {Number}
17732
17770
  */
17733
17771
  getRy() {
17734
- return this.get('ry') * this.get('scaleY');
17772
+ return this.get('ry') * this.get(SCALE_Y);
17735
17773
  }
17736
17774
 
17737
17775
  /**
@@ -18037,7 +18075,7 @@
18037
18075
  _set(key, value) {
18038
18076
  const changed = this.initialized && this[key] !== value;
18039
18077
  const output = super._set(key, value);
18040
- if (this.exactBoundingBox && changed && ((key === 'scaleX' || key === 'scaleY') && this.strokeUniform && this.constructor.layoutProperties.includes('strokeUniform') || this.constructor.layoutProperties.includes(key))) {
18078
+ if (this.exactBoundingBox && changed && ((key === SCALE_X || key === SCALE_Y) && this.strokeUniform && this.constructor.layoutProperties.includes('strokeUniform') || this.constructor.layoutProperties.includes(key))) {
18041
18079
  this.setDimensions();
18042
18080
  }
18043
18081
  return output;
@@ -18156,7 +18194,7 @@
18156
18194
  */
18157
18195
  _defineProperty(Polyline, "ownDefaults", polylineDefaultValues);
18158
18196
  _defineProperty(Polyline, "type", 'Polyline');
18159
- _defineProperty(Polyline, "layoutProperties", ['skewX', 'skewY', 'strokeLineCap', 'strokeLineJoin', 'strokeMiterLimit', 'strokeWidth', 'strokeUniform', 'points']);
18197
+ _defineProperty(Polyline, "layoutProperties", [SKEW_X, SKEW_Y, 'strokeLineCap', 'strokeLineJoin', 'strokeMiterLimit', 'strokeWidth', 'strokeUniform', 'points']);
18160
18198
  _defineProperty(Polyline, "cacheProperties", [...cacheProperties, 'points']);
18161
18199
  _defineProperty(Polyline, "ATTRIBUTE_NAMES", [...SHARED_ATTRIBUTES]);
18162
18200
  classRegistry.setClass(Polyline);
@@ -18176,7 +18214,7 @@
18176
18214
  const textDecorationProperties = ['underline', 'overline', 'linethrough'];
18177
18215
  const textLayoutProperties = [...fontProperties, 'lineHeight', 'text', 'charSpacing', 'textAlign', 'styles', 'path', 'pathStartOffset', 'pathSide', 'pathAlign'];
18178
18216
  const additionalProps = [...textLayoutProperties, ...textDecorationProperties, 'textBackgroundColor', 'direction'];
18179
- const styleProperties = [...fontProperties, ...textDecorationProperties, 'stroke', 'strokeWidth', 'fill', 'deltaY', 'textBackgroundColor'];
18217
+ const styleProperties = [...fontProperties, ...textDecorationProperties, STROKE, 'strokeWidth', FILL, 'deltaY', 'textBackgroundColor'];
18180
18218
 
18181
18219
  // @TODO: Many things here are configuration related and shouldn't be on the class nor prototype
18182
18220
  // regexes, list of properties that are not suppose to change by instances, magic consts.
@@ -18698,7 +18736,7 @@
18698
18736
  deltaY
18699
18737
  } = style;
18700
18738
  const textDecoration = this.getSvgTextDecoration(style);
18701
- return [stroke ? colorPropToSVG('stroke', stroke) : '', strokeWidth ? "stroke-width: ".concat(strokeWidth, "; ") : '', fontFamily ? "font-family: ".concat(!fontFamily.includes("'") && !fontFamily.includes('"') ? "'".concat(fontFamily, "'") : fontFamily, "; ") : '', fontSize ? "font-size: ".concat(fontSize, "px; ") : '', fontStyle ? "font-style: ".concat(fontStyle, "; ") : '', fontWeight ? "font-weight: ".concat(fontWeight, "; ") : '', textDecoration ? "text-decoration: ".concat(textDecoration, "; ") : textDecoration, fill ? colorPropToSVG('fill', fill) : '', deltaY ? "baseline-shift: ".concat(-deltaY, "; ") : '', useWhiteSpace ? 'white-space: pre; ' : ''].join('');
18739
+ return [stroke ? colorPropToSVG(STROKE, stroke) : '', strokeWidth ? "stroke-width: ".concat(strokeWidth, "; ") : '', fontFamily ? "font-family: ".concat(!fontFamily.includes("'") && !fontFamily.includes('"') ? "'".concat(fontFamily, "'") : fontFamily, "; ") : '', fontSize ? "font-size: ".concat(fontSize, "px; ") : '', fontStyle ? "font-style: ".concat(fontStyle, "; ") : '', fontWeight ? "font-weight: ".concat(fontWeight, "; ") : '', textDecoration ? "text-decoration: ".concat(textDecoration, "; ") : textDecoration, fill ? colorPropToSVG(FILL, fill) : '', deltaY ? "baseline-shift: ".concat(-deltaY, "; ") : '', useWhiteSpace ? 'white-space: pre; ' : ''].join('');
18702
18740
  }
18703
18741
 
18704
18742
  /**
@@ -18932,7 +18970,7 @@
18932
18970
  * @param {CanvasRenderingContext2D} ctx Context to render on
18933
18971
  */
18934
18972
  _renderText(ctx) {
18935
- if (this.paintFirst === 'stroke') {
18973
+ if (this.paintFirst === STROKE) {
18936
18974
  this._renderTextStroke(ctx);
18937
18975
  this._renderTextFill(ctx);
18938
18976
  } else {
@@ -19336,7 +19374,7 @@
19336
19374
  * @param {CanvasRenderingContext2D} ctx Context to render on
19337
19375
  */
19338
19376
  _renderTextFill(ctx) {
19339
- if (!this.fill && !this.styleHas('fill')) {
19377
+ if (!this.fill && !this.styleHas(FILL)) {
19340
19378
  return;
19341
19379
  }
19342
19380
  this._renderTextCommon(ctx, 'fillText');
@@ -19723,7 +19761,7 @@
19723
19761
  let boxStart = 0;
19724
19762
  let boxWidth = 0;
19725
19763
  let lastDecoration = this.getValueOfPropertyAt(i, 0, type);
19726
- let lastFill = this.getValueOfPropertyAt(i, 0, 'fill');
19764
+ let lastFill = this.getValueOfPropertyAt(i, 0, FILL);
19727
19765
  let currentDecoration;
19728
19766
  let currentFill;
19729
19767
  const top = topOffset + maxHeight * (1 - this._fontSizeFraction);
@@ -19732,7 +19770,7 @@
19732
19770
  for (let j = 0, jlen = line.length; j < jlen; j++) {
19733
19771
  const charBox = this.__charBounds[i][j];
19734
19772
  currentDecoration = this.getValueOfPropertyAt(i, j, type);
19735
- currentFill = this.getValueOfPropertyAt(i, j, 'fill');
19773
+ currentFill = this.getValueOfPropertyAt(i, j, FILL);
19736
19774
  const currentSize = this.getHeightOfChar(i, j);
19737
19775
  const currentDy = this.getValueOfPropertyAt(i, j, 'deltaY');
19738
19776
  if (path && currentDecoration && currentFill) {
@@ -20259,7 +20297,7 @@
20259
20297
  target.hiddenTextarea.value = target.text;
20260
20298
  target._updateTextarea();
20261
20299
  target.hiddenTextarea.focus();
20262
- target.fire('changed', {
20300
+ target.fire(CHANGED, {
20263
20301
  index: insertAt + selectionStartOffset,
20264
20302
  action: 'drop'
20265
20303
  });
@@ -20305,7 +20343,7 @@
20305
20343
  target.selectionStart = target.selectionEnd = selectionStart;
20306
20344
  target.hiddenTextarea && (target.hiddenTextarea.value = target.text);
20307
20345
  target._updateTextarea();
20308
- target.fire('changed', {
20346
+ target.fire(CHANGED, {
20309
20347
  index: selectionStart,
20310
20348
  action: 'dragend'
20311
20349
  });
@@ -20883,7 +20921,7 @@
20883
20921
  this.setCoords();
20884
20922
  }
20885
20923
  this.fire('editing:exited');
20886
- isTextChanged && this.fire('modified');
20924
+ isTextChanged && this.fire(MODIFIED);
20887
20925
  if (this.canvas) {
20888
20926
  this.canvas.fire('text:editing:exited', {
20889
20927
  target: this
@@ -21362,7 +21400,7 @@
21362
21400
  }
21363
21401
  const updateAndFire = () => {
21364
21402
  this.updateFromTextArea();
21365
- this.fire('changed');
21403
+ this.fire(CHANGED);
21366
21404
  if (this.canvas) {
21367
21405
  this.canvas.fire('text:changed', {
21368
21406
  target: this
@@ -22463,7 +22501,7 @@
22463
22501
  // and why can't happen at the top of the function
22464
22502
  this.renderSelection(ctx, boundaries);
22465
22503
  }
22466
- ctx.fillStyle = this.cursorColor || this.getValueOfPropertyAt(lineIndex, charIndex, 'fill');
22504
+ ctx.fillStyle = this.cursorColor || this.getValueOfPropertyAt(lineIndex, charIndex, FILL);
22467
22505
  ctx.globalAlpha = this._currentCursorOpacity;
22468
22506
  ctx.fillRect(boundaries.left + boundaries.leftOffset - cursorWidth / 2, topOffset + boundaries.top + dy, cursorWidth, charHeight);
22469
22507
  }
@@ -22580,7 +22618,7 @@
22580
22618
  */
22581
22619
  getCurrentCharColor() {
22582
22620
  const cp = this._getCurrentCharIndex();
22583
- return this.getValueOfPropertyAt(cp.l, cp.c, 'fill');
22621
+ return this.getValueOfPropertyAt(cp.l, cp.c, FILL);
22584
22622
  }
22585
22623
 
22586
22624
  /**
@@ -23170,7 +23208,8 @@
23170
23208
  target
23171
23209
  } = context;
23172
23210
  const {
23173
- clipPath
23211
+ clipPath,
23212
+ group
23174
23213
  } = target;
23175
23214
  if (!clipPath || !this.shouldPerformLayout(context)) {
23176
23215
  return;
@@ -23182,9 +23221,8 @@
23182
23221
  } = makeBoundingBoxFromPoints(getObjectBounds(target, clipPath));
23183
23222
  const size = new Point(width, height);
23184
23223
  if (clipPath.absolutePositioned) {
23185
- var _target$group;
23186
23224
  // we want the center point to exist in group's containing plane
23187
- const clipPathCenter = sendPointToPlane(clipPath.getRelativeCenterPoint(), undefined, (_target$group = target.group) === null || _target$group === void 0 ? void 0 : _target$group.calcTransformMatrix());
23225
+ const clipPathCenter = sendPointToPlane(clipPath.getRelativeCenterPoint(), undefined, group ? group.calcTransformMatrix() : undefined);
23188
23226
  return {
23189
23227
  center: clipPathCenter,
23190
23228
  size
@@ -24150,7 +24188,7 @@
24150
24188
  strokeSvg = ["\t<rect x=\"".concat(x, "\" y=\"").concat(y, "\" width=\"").concat(this.width, "\" height=\"").concat(this.height, "\" style=\"").concat(this.getSvgStyles(), "\" />\n")];
24151
24189
  this.fill = origFill;
24152
24190
  }
24153
- if (this.paintFirst !== 'fill') {
24191
+ if (this.paintFirst !== FILL) {
24154
24192
  svgString = svgString.concat(strokeSvg, imageMarkup);
24155
24193
  } else {
24156
24194
  svgString = svgString.concat(imageMarkup, strokeSvg);
@@ -24897,8 +24935,8 @@
24897
24935
  const klass = findTag(el);
24898
24936
  if (klass) {
24899
24937
  const obj = await klass.fromElement(el, this.options, this.cssRules);
24900
- this.resolveGradient(obj, el, 'fill');
24901
- this.resolveGradient(obj, el, 'stroke');
24938
+ this.resolveGradient(obj, el, FILL);
24939
+ this.resolveGradient(obj, el, STROKE);
24902
24940
  if (obj instanceof FabricImage && obj._originalElement) {
24903
24941
  removeTransformMatrixForSvgParsing(obj, obj.parsePreserveAspectRatioAttribute());
24904
24942
  } else {
@@ -25124,7 +25162,7 @@
25124
25162
  });
25125
25163
  }
25126
25164
 
25127
- const ACTION_NAME = 'modifyPoly';
25165
+ const ACTION_NAME = MODIFY_POLY;
25128
25166
  /**
25129
25167
  * This function locates the controls.
25130
25168
  * It'll be used both for drawing and for interaction.
@@ -26023,7 +26061,7 @@
26023
26061
  */
26024
26062
  sendUniformData(gl, uniformLocations) {
26025
26063
  const delta = this.chooseRightDelta();
26026
- gl.uniform2fv(uniformLocations.delta, delta);
26064
+ gl.uniform2fv(uniformLocations.uDelta, delta);
26027
26065
  }
26028
26066
  isNeutralState() {
26029
26067
  return this.blur === 0;
@@ -26978,7 +27016,7 @@
26978
27016
  }
26979
27017
  _defineProperty(Pixelate, "type", 'Pixelate');
26980
27018
  _defineProperty(Pixelate, "defaults", pixelateDefaultValues);
26981
- _defineProperty(Pixelate, "uniformLocations", ['uBlockSize']);
27019
+ _defineProperty(Pixelate, "uniformLocations", ['uBlocksize']);
26982
27020
  classRegistry.setClass(Pixelate);
26983
27021
 
26984
27022
  const fragmentShader = "\nprecision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uLow;\nuniform vec4 uHigh;\nvarying vec2 vTexCoord;\nvoid main() {\n gl_FragColor = texture2D(uTexture, vTexCoord);\n if(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\n gl_FragColor.a = 0.0;\n }\n}\n";
@@ -27673,6 +27711,7 @@
27673
27711
  exports.Group = Group;
27674
27712
  exports.IText = IText;
27675
27713
  exports.Image = FabricImage;
27714
+ exports.InteractiveFabricObject = InteractiveFabricObject;
27676
27715
  exports.Intersection = Intersection;
27677
27716
  exports.LayoutManager = LayoutManager;
27678
27717
  exports.LayoutStrategy = LayoutStrategy;