fabric-vectr 6.7.6 → 6.7.8

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 (48) hide show
  1. package/dist/index.js +33 -18
  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 +33 -18
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/index.node.cjs +33 -18
  10. package/dist/index.node.cjs.map +1 -1
  11. package/dist/index.node.mjs +33 -18
  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 +20 -12
  25. package/dist/src/canvas/Canvas.mjs.map +1 -1
  26. package/dist/src/canvas/StaticCanvas.d.ts +1 -1
  27. package/dist/src/shapes/Group.d.ts +1 -1
  28. package/dist/src/shapes/IText/IText.d.ts.map +1 -1
  29. package/dist/src/shapes/IText/IText.min.mjs +1 -1
  30. package/dist/src/shapes/IText/IText.min.mjs.map +1 -1
  31. package/dist/src/shapes/IText/IText.mjs +7 -0
  32. package/dist/src/shapes/IText/IText.mjs.map +1 -1
  33. package/dist/src/shapes/Textbox.min.mjs +1 -1
  34. package/dist/src/shapes/Textbox.min.mjs.map +1 -1
  35. package/dist/src/shapes/Textbox.mjs +1 -1
  36. package/dist/src/shapes/Textbox.mjs.map +1 -1
  37. package/dist-extensions/src/Collection.d.ts +1 -1
  38. package/dist-extensions/src/Collection.d.ts.map +1 -1
  39. package/dist-extensions/src/canvas/Canvas.d.ts.map +1 -1
  40. package/dist-extensions/src/canvas/StaticCanvas.d.ts +1 -1
  41. package/dist-extensions/src/shapes/Group.d.ts +1 -1
  42. package/dist-extensions/src/shapes/IText/IText.d.ts.map +1 -1
  43. package/package-lock.json +12236 -0
  44. package/package.json +1 -1
  45. package/src/Collection.ts +3 -2
  46. package/src/canvas/Canvas.ts +20 -11
  47. package/src/shapes/IText/IText.ts +7 -0
  48. 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.6";
369
+ var version = "6.7.8";
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
  }
@@ -15588,6 +15588,8 @@
15588
15588
  } else if (!isClick && !((_this$_activeObject = this._activeObject) !== null && _this$_activeObject !== void 0 && _this$_activeObject.isEditing)) {
15589
15589
  this.renderTop();
15590
15590
  }
15591
+ // 框选不改变locked对象,不框选时如果没有点击到可以锁定组,设置锁定组为null
15592
+ if (isClick && !this.getActiveObject()) this.isolatedObject = null;
15591
15593
  }
15592
15594
  _basicEventHandler(eventType, options) {
15593
15595
  const {
@@ -15727,11 +15729,14 @@
15727
15729
  }
15728
15730
  this.setFixedSearchTargets(null);
15729
15731
  }
15730
- this.isolatedObject = isolatedObject;
15731
- // use __onMouseDown select other object immediately after unlocking
15732
- this._resetTransformEventData();
15733
- this.__onMouseDown(e);
15734
- return true;
15732
+ if (isolatedObject) {
15733
+ this.isolatedObject = isolatedObject;
15734
+ // use __onMouseDown select other object immediately after unlocking
15735
+ this._resetTransformEventData();
15736
+ this.__onMouseDown(e);
15737
+ return true;
15738
+ }
15739
+ return false;
15735
15740
  }
15736
15741
 
15737
15742
  /**
@@ -15779,8 +15784,11 @@
15779
15784
  grouped = true;
15780
15785
  shouldRender = true;
15781
15786
  } else if (this._shouldClearSelection(e, target)) {
15787
+ const objs = this.getActiveObjects();
15782
15788
  this.discardActiveObject(e);
15783
- if (this.switchIsolateObject(e)) {
15789
+ // 多选取消,重置Coords, 防止无法再次选中
15790
+ objs.forEach(obj => obj.setCoords());
15791
+ if (!target && this.switchIsolateObject(e)) {
15784
15792
  return;
15785
15793
  }
15786
15794
  }
@@ -16110,11 +16118,11 @@
16110
16118
  if (target === activeObject) {
16111
16119
  const pointer = this.getViewportPoint(e);
16112
16120
  target =
16113
- // first search active objects for a target to remove
16114
- this.searchPossibleTargets(prevActiveObjects, pointer) ||
16115
- // if not found, search under active selection for a target to add
16116
- // `prevActiveObjects` will be searched but we already know they will not be found
16117
- this.searchPossibleTargets(this.getSearchTargets(), pointer);
16121
+ // first search under active selection for a target to add
16122
+ // will search from top level to bottom
16123
+ this.searchPossibleTargets(this.getSearchTargets(), pointer) ||
16124
+ // if not found, search active objects for a target to remove
16125
+ this.searchPossibleTargets(prevActiveObjects, pointer);
16118
16126
 
16119
16127
  // if nothing is found bail out
16120
16128
  if (!target || !target.selectable) {
@@ -16186,7 +16194,7 @@
16186
16194
  tl = point1.min(point2),
16187
16195
  br = point1.max(point2),
16188
16196
  size = br.subtract(tl);
16189
- const collectedObjects = this.collectObjects({
16197
+ const collectedObjects = this.collectObjects(this.getSearchTargets(), {
16190
16198
  left: tl.x,
16191
16199
  top: tl.y,
16192
16200
  width: size.x,
@@ -23357,6 +23365,13 @@
23357
23365
  }
23358
23366
  this.canvas.contextTopDirty = true;
23359
23367
  ctx.restore();
23368
+
23369
+ // For grouped objects, ensure selection is rendered after other operations
23370
+ if (this.parent && this.selectionStart !== this.selectionEnd) {
23371
+ setTimeout(() => {
23372
+ this.renderCursorOrSelection();
23373
+ }, 0);
23374
+ }
23360
23375
  }
23361
23376
 
23362
23377
  /**
@@ -24398,7 +24413,7 @@
24398
24413
  rightGap = Math.max(rightGap, maxRight - (v.right || 0));
24399
24414
  });
24400
24415
  // 计算中心点位置
24401
- if (maxCenter && minCenter) {
24416
+ if (maxCenter !== null && minCenter !== null) {
24402
24417
  const centerOff = maxCenter - minCenter;
24403
24418
  const onCharWidth = (lines[maxCharIdx].width || 0) / lines[maxCharIdx].text.length;
24404
24419
  // 左边间距大于右边两倍 或者 中心点偏移超过1/2字符且右边间距小于1/3字符