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
package/dist/index.js CHANGED
@@ -366,7 +366,7 @@
366
366
  }
367
367
  const cache = new Cache();
368
368
 
369
- var version = "6.7.7";
369
+ var version = "6.7.9";
370
370
 
371
371
  // use this syntax so babel plugin see this import here
372
372
  const VERSION = version;
@@ -1392,7 +1392,7 @@
1392
1392
  * @param {{ includeIntersecting?: boolean }} options an object with includeIntersecting
1393
1393
  * @returns array of objects contained in the bounding box, ordered from top to bottom stacking wise
1394
1394
  */
1395
- collectObjects(_ref) {
1395
+ collectObjects(fromObjects, _ref) {
1396
1396
  let {
1397
1397
  left,
1398
1398
  top,
@@ -1401,14 +1401,14 @@
1401
1401
  } = _ref;
1402
1402
  let {
1403
1403
  includeIntersecting = true
1404
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1404
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1405
1405
  const objects = [],
1406
1406
  tl = new Point(left, top),
1407
1407
  br = tl.add(new Point(width, height));
1408
1408
 
1409
1409
  // we iterate reverse order to collect top first in case of click.
1410
- for (let i = this._objects.length - 1; i >= 0; i--) {
1411
- const object = this._objects[i];
1410
+ for (let i = fromObjects.length - 1; i >= 0; i--) {
1411
+ const object = fromObjects[i];
1412
1412
  if (object.selectable && object.visible && (includeIntersecting && object.intersectsWithRect(tl, br) || object.isContainedWithinRect(tl, br) || includeIntersecting && object.containsPoint(tl) || includeIntersecting && object.containsPoint(br))) {
1413
1413
  objects.push(object);
1414
1414
  }
@@ -3081,7 +3081,7 @@
3081
3081
  if (!isTextObject(instance) || !instance.path) {
3082
3082
  continue;
3083
3083
  }
3084
- let pathId = `TEXTPATH_${uid()}`;
3084
+ let pathId = `TEXTPATH_${instance.id}`;
3085
3085
  let pathMarkup = instance.path._toSVG();
3086
3086
  let index = pathMarkup.indexOf('COMMON_PARTS');
3087
3087
  // 加上id, 和路径偏移
@@ -14204,7 +14204,9 @@
14204
14204
  activeObject = this._activeObject,
14205
14205
  aObjects = this.getActiveObjects();
14206
14206
  this.targets = [];
14207
- if (activeObject && aObjects.length >= 1 && !this._fixedSearchTargets) {
14207
+
14208
+ // valid _fixedSearchTargets is null or _fixedSearchTargets includes activeObject
14209
+ if (activeObject && aObjects.length >= 1 && (!this._fixedSearchTargets || this._fixedSearchTargets.includes(activeObject))) {
14208
14210
  if (activeObject.findControl(pointer, isTouchEvent(e))) {
14209
14211
  // if we hit the corner of the active object, let's return that.
14210
14212
  return activeObject;
@@ -15588,6 +15590,8 @@
15588
15590
  } else if (!isClick && !((_this$_activeObject = this._activeObject) !== null && _this$_activeObject !== void 0 && _this$_activeObject.isEditing)) {
15589
15591
  this.renderTop();
15590
15592
  }
15593
+ // 框选不改变locked对象,不框选时如果没有点击到可以锁定组,设置锁定组为null
15594
+ if (isClick && !this.getActiveObject()) this.isolatedObject = null;
15591
15595
  }
15592
15596
  _basicEventHandler(eventType, options) {
15593
15597
  const {
@@ -15727,11 +15731,14 @@
15727
15731
  }
15728
15732
  this.setFixedSearchTargets(null);
15729
15733
  }
15730
- this.isolatedObject = isolatedObject;
15731
- // use __onMouseDown select other object immediately after unlocking
15732
- this._resetTransformEventData();
15733
- this.__onMouseDown(e);
15734
- return true;
15734
+ if (isolatedObject) {
15735
+ this.isolatedObject = isolatedObject;
15736
+ // use __onMouseDown select other object immediately after unlocking
15737
+ this._resetTransformEventData();
15738
+ this.__onMouseDown(e);
15739
+ return true;
15740
+ }
15741
+ return false;
15735
15742
  }
15736
15743
 
15737
15744
  /**
@@ -15779,8 +15786,11 @@
15779
15786
  grouped = true;
15780
15787
  shouldRender = true;
15781
15788
  } else if (this._shouldClearSelection(e, target)) {
15789
+ const objs = this.getActiveObjects();
15782
15790
  this.discardActiveObject(e);
15783
- if (this.switchIsolateObject(e)) {
15791
+ // 多选取消,重置Coords, 防止无法再次选中
15792
+ objs.forEach(obj => obj.setCoords());
15793
+ if (!target && this.switchIsolateObject(e)) {
15784
15794
  return;
15785
15795
  }
15786
15796
  }
@@ -16186,7 +16196,7 @@
16186
16196
  tl = point1.min(point2),
16187
16197
  br = point1.max(point2),
16188
16198
  size = br.subtract(tl);
16189
- const collectedObjects = this.collectObjects({
16199
+ const collectedObjects = this.collectObjects(this.getSearchTargets(), {
16190
16200
  left: tl.x,
16191
16201
  top: tl.y,
16192
16202
  width: size.x,
@@ -23357,6 +23367,13 @@
23357
23367
  }
23358
23368
  this.canvas.contextTopDirty = true;
23359
23369
  ctx.restore();
23370
+
23371
+ // For grouped objects, ensure selection is rendered after other operations
23372
+ if (this.parent && this.selectionStart !== this.selectionEnd) {
23373
+ setTimeout(() => {
23374
+ this.renderCursorOrSelection();
23375
+ }, 0);
23376
+ }
23360
23377
  }
23361
23378
 
23362
23379
  /**
@@ -24398,7 +24415,7 @@
24398
24415
  rightGap = Math.max(rightGap, maxRight - (v.right || 0));
24399
24416
  });
24400
24417
  // 计算中心点位置
24401
- if (maxCenter && minCenter) {
24418
+ if (maxCenter !== null && minCenter !== null) {
24402
24419
  const centerOff = maxCenter - minCenter;
24403
24420
  const onCharWidth = (lines[maxCharIdx].width || 0) / lines[maxCharIdx].text.length;
24404
24421
  // 左边间距大于右边两倍 或者 中心点偏移超过1/2字符且右边间距小于1/3字符