fabric-vectr 6.7.3 → 6.7.5

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 (57) hide show
  1. package/dist/index.js +56 -49
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.min.js +1 -1
  4. package/dist/index.min.js.map +1 -1
  5. package/dist/index.min.mjs +1 -1
  6. package/dist/index.min.mjs.map +1 -1
  7. package/dist/index.mjs +56 -49
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/index.node.cjs +56 -49
  10. package/dist/index.node.cjs.map +1 -1
  11. package/dist/index.node.mjs +56 -49
  12. package/dist/index.node.mjs.map +1 -1
  13. package/dist/package.json.min.mjs +1 -1
  14. package/dist/package.json.mjs +1 -1
  15. package/dist/src/canvas/Canvas.min.mjs +1 -1
  16. package/dist/src/canvas/Canvas.min.mjs.map +1 -1
  17. package/dist/src/canvas/Canvas.mjs +4 -4
  18. package/dist/src/canvas/Canvas.mjs.map +1 -1
  19. package/dist/src/canvas/SelectableCanvas.d.ts +3 -3
  20. package/dist/src/canvas/SelectableCanvas.d.ts.map +1 -1
  21. package/dist/src/canvas/SelectableCanvas.min.mjs +1 -1
  22. package/dist/src/canvas/SelectableCanvas.min.mjs.map +1 -1
  23. package/dist/src/canvas/SelectableCanvas.mjs +6 -6
  24. package/dist/src/canvas/SelectableCanvas.mjs.map +1 -1
  25. package/dist/src/shapes/Group.d.ts.map +1 -1
  26. package/dist/src/shapes/Group.min.mjs +1 -1
  27. package/dist/src/shapes/Group.min.mjs.map +1 -1
  28. package/dist/src/shapes/Group.mjs +1 -1
  29. package/dist/src/shapes/Group.mjs.map +1 -1
  30. package/dist/src/shapes/Object/InteractiveObject.d.ts +6 -0
  31. package/dist/src/shapes/Object/InteractiveObject.d.ts.map +1 -1
  32. package/dist/src/shapes/Object/InteractiveObject.min.mjs +1 -1
  33. package/dist/src/shapes/Object/InteractiveObject.min.mjs.map +1 -1
  34. package/dist/src/shapes/Object/InteractiveObject.mjs +41 -35
  35. package/dist/src/shapes/Object/InteractiveObject.mjs.map +1 -1
  36. package/dist/src/shapes/Text/Text.min.mjs +1 -1
  37. package/dist/src/shapes/Text/Text.min.mjs.map +1 -1
  38. package/dist/src/shapes/Text/Text.mjs +2 -2
  39. package/dist/src/shapes/Text/Text.mjs.map +1 -1
  40. package/dist/src/shapes/Textbox.d.ts.map +1 -1
  41. package/dist/src/shapes/Textbox.min.mjs +1 -1
  42. package/dist/src/shapes/Textbox.min.mjs.map +1 -1
  43. package/dist/src/shapes/Textbox.mjs +1 -0
  44. package/dist/src/shapes/Textbox.mjs.map +1 -1
  45. package/dist-extensions/src/canvas/SelectableCanvas.d.ts +3 -3
  46. package/dist-extensions/src/canvas/SelectableCanvas.d.ts.map +1 -1
  47. package/dist-extensions/src/shapes/Group.d.ts.map +1 -1
  48. package/dist-extensions/src/shapes/Object/InteractiveObject.d.ts +6 -0
  49. package/dist-extensions/src/shapes/Object/InteractiveObject.d.ts.map +1 -1
  50. package/dist-extensions/src/shapes/Textbox.d.ts.map +1 -1
  51. package/package.json +2 -2
  52. package/src/canvas/Canvas.ts +4 -4
  53. package/src/canvas/SelectableCanvas.ts +6 -6
  54. package/src/shapes/Group.ts +4 -1
  55. package/src/shapes/Object/InteractiveObject.ts +7 -0
  56. package/src/shapes/Text/Text.ts +2 -2
  57. package/src/shapes/Textbox.ts +1 -0
package/dist/index.js CHANGED
@@ -366,7 +366,7 @@
366
366
  }
367
367
  const cache = new Cache();
368
368
 
369
- var version = "6.7.3";
369
+ var version = "6.7.5";
370
370
 
371
371
  // use this syntax so babel plugin see this import here
372
372
  const VERSION = version;
@@ -9549,6 +9549,47 @@
9549
9549
  */
9550
9550
  constructor(options) {
9551
9551
  super();
9552
+ /**
9553
+ * The object's controls' position in viewport coordinates
9554
+ * Calculated by {@link Control#positionHandler} and {@link Control#calcCornerCoords}, depending on {@link padding}.
9555
+ * `corner/touchCorner` describe the 4 points forming the interactive area of the corner.
9556
+ * Used to draw and locate controls.
9557
+ */
9558
+ /**
9559
+ * keeps the value of the last hovered corner during mouse move.
9560
+ * 0 is no corner, or 'mt', 'ml', 'mtr' etc..
9561
+ * It should be private, but there is no harm in using it as
9562
+ * a read-only property.
9563
+ * this isn't cleaned automatically. Non selected objects may have wrong values
9564
+ * @type [string]
9565
+ */
9566
+ /**
9567
+ * a map of control visibility for this object.
9568
+ * this was left when controls were introduced to not break the api too much
9569
+ * this takes priority over the generic control visibility
9570
+ */
9571
+ /**
9572
+ * holds the controls for the object.
9573
+ * controls are added by default_controls.js
9574
+ */
9575
+ /**
9576
+ * internal boolean to signal the code that the object is
9577
+ * part of the move action.
9578
+ */
9579
+ /**
9580
+ * A boolean used from the gesture module to keep tracking of a scaling
9581
+ * action when there is no scaling transform in place.
9582
+ * This is an edge case and is used twice in all codebase.
9583
+ * Probably added to keep track of some performance issues
9584
+ * @TODO use git blame to investigate why it was added
9585
+ * DON'T USE IT. WE WILL TRY TO REMOVE IT
9586
+ */
9587
+ /**
9588
+ * When set to `true`, object's group should not cache
9589
+ * @type Boolean
9590
+ * @default false
9591
+ */
9592
+ _defineProperty(this, "preventGroupCache", void 0);
9552
9593
  Object.assign(this, this.constructor.createControls(), InteractiveFabricObject.ownDefaults);
9553
9594
  this.setOptions(options);
9554
9595
  }
@@ -10042,41 +10083,6 @@
10042
10083
  // for subclasses
10043
10084
  }
10044
10085
  }
10045
- /**
10046
- * The object's controls' position in viewport coordinates
10047
- * Calculated by {@link Control#positionHandler} and {@link Control#calcCornerCoords}, depending on {@link padding}.
10048
- * `corner/touchCorner` describe the 4 points forming the interactive area of the corner.
10049
- * Used to draw and locate controls.
10050
- */
10051
- /**
10052
- * keeps the value of the last hovered corner during mouse move.
10053
- * 0 is no corner, or 'mt', 'ml', 'mtr' etc..
10054
- * It should be private, but there is no harm in using it as
10055
- * a read-only property.
10056
- * this isn't cleaned automatically. Non selected objects may have wrong values
10057
- * @type [string]
10058
- */
10059
- /**
10060
- * a map of control visibility for this object.
10061
- * this was left when controls were introduced to not break the api too much
10062
- * this takes priority over the generic control visibility
10063
- */
10064
- /**
10065
- * holds the controls for the object.
10066
- * controls are added by default_controls.js
10067
- */
10068
- /**
10069
- * internal boolean to signal the code that the object is
10070
- * part of the move action.
10071
- */
10072
- /**
10073
- * A boolean used from the gesture module to keep tracking of a scaling
10074
- * action when there is no scaling transform in place.
10075
- * This is an edge case and is used twice in all codebase.
10076
- * Probably added to keep track of some performance issues
10077
- * @TODO use git blame to investigate why it was added
10078
- * DON'T USE IT. WE WILL TRY TO REMOVE IT
10079
- */
10080
10086
  _defineProperty(InteractiveFabricObject, "ownDefaults", interactiveObjectDefaultValues);
10081
10087
 
10082
10088
  /***
@@ -12074,7 +12080,7 @@
12074
12080
  const ownCache = FabricObject.prototype.shouldCache.call(this);
12075
12081
  if (ownCache) {
12076
12082
  for (let i = 0; i < this._objects.length; i++) {
12077
- if (this._objects[i].willDrawShadow()) {
12083
+ if (this._objects[i].willDrawShadow() || this._objects[i].preventGroupCache) {
12078
12084
  this.ownCaching = false;
12079
12085
  return false;
12080
12086
  }
@@ -13724,11 +13730,11 @@
13724
13730
  */
13725
13731
  _defineProperty(this, "isolatedObject", void 0);
13726
13732
  /**
13727
- * Specified search objects
13733
+ * Fixed search objects
13728
13734
  * @type Boolean
13729
13735
  * @default null
13730
13736
  */
13731
- _defineProperty(this, "_searchTargets", void 0);
13737
+ _defineProperty(this, "_fixedSearchTargets", void 0);
13732
13738
  /**
13733
13739
  * Keep track of the subTargets for Mouse Events, ordered bottom up from innermost nested subTarget
13734
13740
  * @type FabricObject[]
@@ -14171,8 +14177,8 @@
14171
14177
  * Manually set the search object
14172
14178
  * @param objects
14173
14179
  */
14174
- setSearchTargets(objects) {
14175
- this._searchTargets = objects;
14180
+ setFixedSearchTargets(objects) {
14181
+ this._fixedSearchTargets = objects;
14176
14182
  }
14177
14183
 
14178
14184
  /**
@@ -14180,7 +14186,7 @@
14180
14186
  * @returns
14181
14187
  */
14182
14188
  getSearchTargets() {
14183
- return this._searchTargets || (this.isolatedObject ? this.isolatedObject._objects : this._objects);
14189
+ return this._fixedSearchTargets || (this.isolatedObject ? this.isolatedObject._objects : this._objects);
14184
14190
  }
14185
14191
 
14186
14192
  /**
@@ -14198,7 +14204,7 @@
14198
14204
  activeObject = this._activeObject,
14199
14205
  aObjects = this.getActiveObjects();
14200
14206
  this.targets = [];
14201
- if (activeObject && aObjects.length >= 1) {
14207
+ if (activeObject && aObjects.length >= 1 && !this._fixedSearchTargets) {
14202
14208
  if (activeObject.findControl(pointer, isTouchEvent(e))) {
14203
14209
  // if we hit the corner of the active object, let's return that.
14204
14210
  return activeObject;
@@ -15690,7 +15696,7 @@
15690
15696
  * @returns
15691
15697
  */
15692
15698
  switchIsolateObject(e) {
15693
- if (!this.isolatedObject || this._searchTargets) return false;
15699
+ if (!this.isolatedObject || this._fixedSearchTargets) return false;
15694
15700
  let isolatedObject = null;
15695
15701
  if (this.isolatedObject.parent) {
15696
15702
  const parents = [];
@@ -15701,12 +15707,12 @@
15701
15707
  }
15702
15708
  // check topmost parent, if it was clicked, find the nearest child object to isolate
15703
15709
  const topmostParent = parents[parents.length - 1];
15704
- this.setSearchTargets([topmostParent]);
15710
+ this.setFixedSearchTargets([topmostParent]);
15705
15711
  let target = this.findTarget(e);
15706
15712
  // parent was clicked
15707
15713
  if (target) {
15708
15714
  parents.some(parent => {
15709
- this.setSearchTargets(parent.getObjects());
15715
+ this.setFixedSearchTargets(parent.getObjects());
15710
15716
  target = this.findTarget(e);
15711
15717
  if (target) {
15712
15718
  isolatedObject = parent;
@@ -15719,7 +15725,7 @@
15719
15725
  return false;
15720
15726
  });
15721
15727
  }
15722
- this.setSearchTargets(null);
15728
+ this.setFixedSearchTargets(null);
15723
15729
  }
15724
15730
  this.isolatedObject = isolatedObject;
15725
15731
  // use __onMouseDown select other object immediately after unlocking
@@ -19819,8 +19825,8 @@
19819
19825
  _getCacheCanvasDimensions() {
19820
19826
  const dims = super._getCacheCanvasDimensions();
19821
19827
  const fontSize = this.fontSize;
19822
- dims.width += fontSize * dims.zoomX;
19823
- dims.height += fontSize * dims.zoomY;
19828
+ dims.width += fontSize * dims.zoomX * 2;
19829
+ dims.height += fontSize * dims.zoomY * 2;
19824
19830
  return dims;
19825
19831
  }
19826
19832
 
@@ -23789,6 +23795,7 @@
23789
23795
  // clear cache and re-calculate height
23790
23796
  this.height = this.calcTextHeight();
23791
23797
  }
23798
+ this.preventGroupCache = this.path ? true : false;
23792
23799
  }
23793
23800
 
23794
23801
  /**