fabric-vectr 6.7.7 → 6.7.9

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 (59) hide show
  1. package/dist/index.js +32 -15
  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 +32 -15
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/index.node.cjs +32 -15
  10. package/dist/index.node.cjs.map +1 -1
  11. package/dist/index.node.mjs +32 -15
  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/Collection.d.ts +1 -1
  16. package/dist/src/Collection.d.ts.map +1 -1
  17. package/dist/src/Collection.min.mjs +1 -1
  18. package/dist/src/Collection.min.mjs.map +1 -1
  19. package/dist/src/Collection.mjs +4 -4
  20. package/dist/src/Collection.mjs.map +1 -1
  21. package/dist/src/canvas/Canvas.d.ts.map +1 -1
  22. package/dist/src/canvas/Canvas.min.mjs +1 -1
  23. package/dist/src/canvas/Canvas.min.mjs.map +1 -1
  24. package/dist/src/canvas/Canvas.mjs +15 -7
  25. package/dist/src/canvas/Canvas.mjs.map +1 -1
  26. package/dist/src/canvas/SelectableCanvas.d.ts.map +1 -1
  27. package/dist/src/canvas/SelectableCanvas.min.mjs +1 -1
  28. package/dist/src/canvas/SelectableCanvas.min.mjs.map +1 -1
  29. package/dist/src/canvas/SelectableCanvas.mjs +3 -1
  30. package/dist/src/canvas/SelectableCanvas.mjs.map +1 -1
  31. package/dist/src/canvas/StaticCanvas.d.ts +1 -1
  32. package/dist/src/canvas/StaticCanvas.min.mjs +1 -1
  33. package/dist/src/canvas/StaticCanvas.min.mjs.map +1 -1
  34. package/dist/src/canvas/StaticCanvas.mjs +1 -1
  35. package/dist/src/canvas/StaticCanvas.mjs.map +1 -1
  36. package/dist/src/shapes/Group.d.ts +1 -1
  37. package/dist/src/shapes/IText/IText.d.ts.map +1 -1
  38. package/dist/src/shapes/IText/IText.min.mjs +1 -1
  39. package/dist/src/shapes/IText/IText.min.mjs.map +1 -1
  40. package/dist/src/shapes/IText/IText.mjs +7 -0
  41. package/dist/src/shapes/IText/IText.mjs.map +1 -1
  42. package/dist/src/shapes/Textbox.min.mjs +1 -1
  43. package/dist/src/shapes/Textbox.min.mjs.map +1 -1
  44. package/dist/src/shapes/Textbox.mjs +1 -1
  45. package/dist/src/shapes/Textbox.mjs.map +1 -1
  46. package/dist-extensions/src/Collection.d.ts +1 -1
  47. package/dist-extensions/src/Collection.d.ts.map +1 -1
  48. package/dist-extensions/src/canvas/Canvas.d.ts.map +1 -1
  49. package/dist-extensions/src/canvas/SelectableCanvas.d.ts.map +1 -1
  50. package/dist-extensions/src/canvas/StaticCanvas.d.ts +1 -1
  51. package/dist-extensions/src/shapes/Group.d.ts +1 -1
  52. package/dist-extensions/src/shapes/IText/IText.d.ts.map +1 -1
  53. package/package.json +1 -1
  54. package/src/Collection.ts +3 -2
  55. package/src/canvas/Canvas.ts +15 -6
  56. package/src/canvas/SelectableCanvas.ts +7 -1
  57. package/src/canvas/StaticCanvas.ts +1 -1
  58. package/src/shapes/IText/IText.ts +7 -0
  59. package/src/shapes/Textbox.ts +1 -1
@@ -416,7 +416,7 @@ class Cache {
416
416
  }
417
417
  const cache = new Cache();
418
418
 
419
- var version = "6.7.7";
419
+ var version = "6.7.9";
420
420
 
421
421
  // use this syntax so babel plugin see this import here
422
422
  const VERSION = version;
@@ -1442,7 +1442,7 @@ function createCollectionMixin(Base) {
1442
1442
  * @param {{ includeIntersecting?: boolean }} options an object with includeIntersecting
1443
1443
  * @returns array of objects contained in the bounding box, ordered from top to bottom stacking wise
1444
1444
  */
1445
- collectObjects(_ref) {
1445
+ collectObjects(fromObjects, _ref) {
1446
1446
  let {
1447
1447
  left,
1448
1448
  top,
@@ -1451,14 +1451,14 @@ function createCollectionMixin(Base) {
1451
1451
  } = _ref;
1452
1452
  let {
1453
1453
  includeIntersecting = true
1454
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1454
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1455
1455
  const objects = [],
1456
1456
  tl = new Point(left, top),
1457
1457
  br = tl.add(new Point(width, height));
1458
1458
 
1459
1459
  // we iterate reverse order to collect top first in case of click.
1460
- for (let i = this._objects.length - 1; i >= 0; i--) {
1461
- const object = this._objects[i];
1460
+ for (let i = fromObjects.length - 1; i >= 0; i--) {
1461
+ const object = fromObjects[i];
1462
1462
  if (object.selectable && object.visible && (includeIntersecting && object.intersectsWithRect(tl, br) || object.isContainedWithinRect(tl, br) || includeIntersecting && object.containsPoint(tl) || includeIntersecting && object.containsPoint(br))) {
1463
1463
  objects.push(object);
1464
1464
  }
@@ -3131,7 +3131,7 @@ let StaticCanvas$1 = class StaticCanvas extends createCollectionMixin(CommonMeth
3131
3131
  if (!isTextObject(instance) || !instance.path) {
3132
3132
  continue;
3133
3133
  }
3134
- let pathId = `TEXTPATH_${uid()}`;
3134
+ let pathId = `TEXTPATH_${instance.id}`;
3135
3135
  let pathMarkup = instance.path._toSVG();
3136
3136
  let index = pathMarkup.indexOf('COMMON_PARTS');
3137
3137
  // 加上id, 和路径偏移
@@ -14254,7 +14254,9 @@ class SelectableCanvas extends StaticCanvas$1 {
14254
14254
  activeObject = this._activeObject,
14255
14255
  aObjects = this.getActiveObjects();
14256
14256
  this.targets = [];
14257
- if (activeObject && aObjects.length >= 1 && !this._fixedSearchTargets) {
14257
+
14258
+ // valid _fixedSearchTargets is null or _fixedSearchTargets includes activeObject
14259
+ if (activeObject && aObjects.length >= 1 && (!this._fixedSearchTargets || this._fixedSearchTargets.includes(activeObject))) {
14258
14260
  if (activeObject.findControl(pointer, isTouchEvent(e))) {
14259
14261
  // if we hit the corner of the active object, let's return that.
14260
14262
  return activeObject;
@@ -15638,6 +15640,8 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
15638
15640
  } else if (!isClick && !((_this$_activeObject = this._activeObject) !== null && _this$_activeObject !== void 0 && _this$_activeObject.isEditing)) {
15639
15641
  this.renderTop();
15640
15642
  }
15643
+ // 框选不改变locked对象,不框选时如果没有点击到可以锁定组,设置锁定组为null
15644
+ if (isClick && !this.getActiveObject()) this.isolatedObject = null;
15641
15645
  }
15642
15646
  _basicEventHandler(eventType, options) {
15643
15647
  const {
@@ -15777,11 +15781,14 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
15777
15781
  }
15778
15782
  this.setFixedSearchTargets(null);
15779
15783
  }
15780
- this.isolatedObject = isolatedObject;
15781
- // use __onMouseDown select other object immediately after unlocking
15782
- this._resetTransformEventData();
15783
- this.__onMouseDown(e);
15784
- return true;
15784
+ if (isolatedObject) {
15785
+ this.isolatedObject = isolatedObject;
15786
+ // use __onMouseDown select other object immediately after unlocking
15787
+ this._resetTransformEventData();
15788
+ this.__onMouseDown(e);
15789
+ return true;
15790
+ }
15791
+ return false;
15785
15792
  }
15786
15793
 
15787
15794
  /**
@@ -15829,8 +15836,11 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
15829
15836
  grouped = true;
15830
15837
  shouldRender = true;
15831
15838
  } else if (this._shouldClearSelection(e, target)) {
15839
+ const objs = this.getActiveObjects();
15832
15840
  this.discardActiveObject(e);
15833
- if (this.switchIsolateObject(e)) {
15841
+ // 多选取消,重置Coords, 防止无法再次选中
15842
+ objs.forEach(obj => obj.setCoords());
15843
+ if (!target && this.switchIsolateObject(e)) {
15834
15844
  return;
15835
15845
  }
15836
15846
  }
@@ -16236,7 +16246,7 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
16236
16246
  tl = point1.min(point2),
16237
16247
  br = point1.max(point2),
16238
16248
  size = br.subtract(tl);
16239
- const collectedObjects = this.collectObjects({
16249
+ const collectedObjects = this.collectObjects(this.getSearchTargets(), {
16240
16250
  left: tl.x,
16241
16251
  top: tl.y,
16242
16252
  width: size.x,
@@ -23407,6 +23417,13 @@ class IText extends ITextClickBehavior {
23407
23417
  }
23408
23418
  this.canvas.contextTopDirty = true;
23409
23419
  ctx.restore();
23420
+
23421
+ // For grouped objects, ensure selection is rendered after other operations
23422
+ if (this.parent && this.selectionStart !== this.selectionEnd) {
23423
+ setTimeout(() => {
23424
+ this.renderCursorOrSelection();
23425
+ }, 0);
23426
+ }
23410
23427
  }
23411
23428
 
23412
23429
  /**
@@ -24448,7 +24465,7 @@ class Textbox extends IText {
24448
24465
  rightGap = Math.max(rightGap, maxRight - (v.right || 0));
24449
24466
  });
24450
24467
  // 计算中心点位置
24451
- if (maxCenter && minCenter) {
24468
+ if (maxCenter !== null && minCenter !== null) {
24452
24469
  const centerOff = maxCenter - minCenter;
24453
24470
  const onCharWidth = (lines[maxCharIdx].width || 0) / lines[maxCharIdx].text.length;
24454
24471
  // 左边间距大于右边两倍 或者 中心点偏移超过1/2字符且右边间距小于1/3字符