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.
- package/dist/index.js +32 -15
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +32 -15
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +32 -15
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +32 -15
- package/dist/index.node.mjs.map +1 -1
- package/dist/package.json.min.mjs +1 -1
- package/dist/package.json.mjs +1 -1
- package/dist/src/Collection.d.ts +1 -1
- package/dist/src/Collection.d.ts.map +1 -1
- package/dist/src/Collection.min.mjs +1 -1
- package/dist/src/Collection.min.mjs.map +1 -1
- package/dist/src/Collection.mjs +4 -4
- package/dist/src/Collection.mjs.map +1 -1
- package/dist/src/canvas/Canvas.d.ts.map +1 -1
- package/dist/src/canvas/Canvas.min.mjs +1 -1
- package/dist/src/canvas/Canvas.min.mjs.map +1 -1
- package/dist/src/canvas/Canvas.mjs +15 -7
- package/dist/src/canvas/Canvas.mjs.map +1 -1
- package/dist/src/canvas/SelectableCanvas.d.ts.map +1 -1
- package/dist/src/canvas/SelectableCanvas.min.mjs +1 -1
- package/dist/src/canvas/SelectableCanvas.min.mjs.map +1 -1
- package/dist/src/canvas/SelectableCanvas.mjs +3 -1
- package/dist/src/canvas/SelectableCanvas.mjs.map +1 -1
- package/dist/src/canvas/StaticCanvas.d.ts +1 -1
- package/dist/src/canvas/StaticCanvas.min.mjs +1 -1
- package/dist/src/canvas/StaticCanvas.min.mjs.map +1 -1
- package/dist/src/canvas/StaticCanvas.mjs +1 -1
- package/dist/src/canvas/StaticCanvas.mjs.map +1 -1
- package/dist/src/shapes/Group.d.ts +1 -1
- package/dist/src/shapes/IText/IText.d.ts.map +1 -1
- package/dist/src/shapes/IText/IText.min.mjs +1 -1
- package/dist/src/shapes/IText/IText.min.mjs.map +1 -1
- package/dist/src/shapes/IText/IText.mjs +7 -0
- package/dist/src/shapes/IText/IText.mjs.map +1 -1
- package/dist/src/shapes/Textbox.min.mjs +1 -1
- package/dist/src/shapes/Textbox.min.mjs.map +1 -1
- package/dist/src/shapes/Textbox.mjs +1 -1
- package/dist/src/shapes/Textbox.mjs.map +1 -1
- package/dist-extensions/src/Collection.d.ts +1 -1
- package/dist-extensions/src/Collection.d.ts.map +1 -1
- package/dist-extensions/src/canvas/Canvas.d.ts.map +1 -1
- package/dist-extensions/src/canvas/SelectableCanvas.d.ts.map +1 -1
- package/dist-extensions/src/canvas/StaticCanvas.d.ts +1 -1
- package/dist-extensions/src/shapes/Group.d.ts +1 -1
- package/dist-extensions/src/shapes/IText/IText.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Collection.ts +3 -2
- package/src/canvas/Canvas.ts +15 -6
- package/src/canvas/SelectableCanvas.ts +7 -1
- package/src/canvas/StaticCanvas.ts +1 -1
- package/src/shapes/IText/IText.ts +7 -0
- package/src/shapes/Textbox.ts +1 -1
package/dist/index.node.cjs
CHANGED
|
@@ -418,7 +418,7 @@ class Cache {
|
|
|
418
418
|
}
|
|
419
419
|
const cache = new Cache();
|
|
420
420
|
|
|
421
|
-
var version = "6.7.
|
|
421
|
+
var version = "6.7.9";
|
|
422
422
|
|
|
423
423
|
// use this syntax so babel plugin see this import here
|
|
424
424
|
const VERSION = version;
|
|
@@ -1444,7 +1444,7 @@ function createCollectionMixin(Base) {
|
|
|
1444
1444
|
* @param {{ includeIntersecting?: boolean }} options an object with includeIntersecting
|
|
1445
1445
|
* @returns array of objects contained in the bounding box, ordered from top to bottom stacking wise
|
|
1446
1446
|
*/
|
|
1447
|
-
collectObjects(_ref) {
|
|
1447
|
+
collectObjects(fromObjects, _ref) {
|
|
1448
1448
|
let {
|
|
1449
1449
|
left,
|
|
1450
1450
|
top,
|
|
@@ -1453,14 +1453,14 @@ function createCollectionMixin(Base) {
|
|
|
1453
1453
|
} = _ref;
|
|
1454
1454
|
let {
|
|
1455
1455
|
includeIntersecting = true
|
|
1456
|
-
} = arguments.length >
|
|
1456
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1457
1457
|
const objects = [],
|
|
1458
1458
|
tl = new Point(left, top),
|
|
1459
1459
|
br = tl.add(new Point(width, height));
|
|
1460
1460
|
|
|
1461
1461
|
// we iterate reverse order to collect top first in case of click.
|
|
1462
|
-
for (let i =
|
|
1463
|
-
const object =
|
|
1462
|
+
for (let i = fromObjects.length - 1; i >= 0; i--) {
|
|
1463
|
+
const object = fromObjects[i];
|
|
1464
1464
|
if (object.selectable && object.visible && (includeIntersecting && object.intersectsWithRect(tl, br) || object.isContainedWithinRect(tl, br) || includeIntersecting && object.containsPoint(tl) || includeIntersecting && object.containsPoint(br))) {
|
|
1465
1465
|
objects.push(object);
|
|
1466
1466
|
}
|
|
@@ -3133,7 +3133,7 @@ let StaticCanvas$1 = class StaticCanvas extends createCollectionMixin(CommonMeth
|
|
|
3133
3133
|
if (!isTextObject(instance) || !instance.path) {
|
|
3134
3134
|
continue;
|
|
3135
3135
|
}
|
|
3136
|
-
let pathId = `TEXTPATH_${
|
|
3136
|
+
let pathId = `TEXTPATH_${instance.id}`;
|
|
3137
3137
|
let pathMarkup = instance.path._toSVG();
|
|
3138
3138
|
let index = pathMarkup.indexOf('COMMON_PARTS');
|
|
3139
3139
|
// 加上id, 和路径偏移
|
|
@@ -14256,7 +14256,9 @@ class SelectableCanvas extends StaticCanvas$1 {
|
|
|
14256
14256
|
activeObject = this._activeObject,
|
|
14257
14257
|
aObjects = this.getActiveObjects();
|
|
14258
14258
|
this.targets = [];
|
|
14259
|
-
|
|
14259
|
+
|
|
14260
|
+
// valid _fixedSearchTargets is null or _fixedSearchTargets includes activeObject
|
|
14261
|
+
if (activeObject && aObjects.length >= 1 && (!this._fixedSearchTargets || this._fixedSearchTargets.includes(activeObject))) {
|
|
14260
14262
|
if (activeObject.findControl(pointer, isTouchEvent(e))) {
|
|
14261
14263
|
// if we hit the corner of the active object, let's return that.
|
|
14262
14264
|
return activeObject;
|
|
@@ -15640,6 +15642,8 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
|
|
|
15640
15642
|
} else if (!isClick && !((_this$_activeObject = this._activeObject) !== null && _this$_activeObject !== void 0 && _this$_activeObject.isEditing)) {
|
|
15641
15643
|
this.renderTop();
|
|
15642
15644
|
}
|
|
15645
|
+
// 框选不改变locked对象,不框选时如果没有点击到可以锁定组,设置锁定组为null
|
|
15646
|
+
if (isClick && !this.getActiveObject()) this.isolatedObject = null;
|
|
15643
15647
|
}
|
|
15644
15648
|
_basicEventHandler(eventType, options) {
|
|
15645
15649
|
const {
|
|
@@ -15779,11 +15783,14 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
|
|
|
15779
15783
|
}
|
|
15780
15784
|
this.setFixedSearchTargets(null);
|
|
15781
15785
|
}
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
15786
|
+
if (isolatedObject) {
|
|
15787
|
+
this.isolatedObject = isolatedObject;
|
|
15788
|
+
// use __onMouseDown select other object immediately after unlocking
|
|
15789
|
+
this._resetTransformEventData();
|
|
15790
|
+
this.__onMouseDown(e);
|
|
15791
|
+
return true;
|
|
15792
|
+
}
|
|
15793
|
+
return false;
|
|
15787
15794
|
}
|
|
15788
15795
|
|
|
15789
15796
|
/**
|
|
@@ -15831,8 +15838,11 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
|
|
|
15831
15838
|
grouped = true;
|
|
15832
15839
|
shouldRender = true;
|
|
15833
15840
|
} else if (this._shouldClearSelection(e, target)) {
|
|
15841
|
+
const objs = this.getActiveObjects();
|
|
15834
15842
|
this.discardActiveObject(e);
|
|
15835
|
-
|
|
15843
|
+
// 多选取消,重置Coords, 防止无法再次选中
|
|
15844
|
+
objs.forEach(obj => obj.setCoords());
|
|
15845
|
+
if (!target && this.switchIsolateObject(e)) {
|
|
15836
15846
|
return;
|
|
15837
15847
|
}
|
|
15838
15848
|
}
|
|
@@ -16238,7 +16248,7 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
|
|
|
16238
16248
|
tl = point1.min(point2),
|
|
16239
16249
|
br = point1.max(point2),
|
|
16240
16250
|
size = br.subtract(tl);
|
|
16241
|
-
const collectedObjects = this.collectObjects({
|
|
16251
|
+
const collectedObjects = this.collectObjects(this.getSearchTargets(), {
|
|
16242
16252
|
left: tl.x,
|
|
16243
16253
|
top: tl.y,
|
|
16244
16254
|
width: size.x,
|
|
@@ -23409,6 +23419,13 @@ class IText extends ITextClickBehavior {
|
|
|
23409
23419
|
}
|
|
23410
23420
|
this.canvas.contextTopDirty = true;
|
|
23411
23421
|
ctx.restore();
|
|
23422
|
+
|
|
23423
|
+
// For grouped objects, ensure selection is rendered after other operations
|
|
23424
|
+
if (this.parent && this.selectionStart !== this.selectionEnd) {
|
|
23425
|
+
setTimeout(() => {
|
|
23426
|
+
this.renderCursorOrSelection();
|
|
23427
|
+
}, 0);
|
|
23428
|
+
}
|
|
23412
23429
|
}
|
|
23413
23430
|
|
|
23414
23431
|
/**
|
|
@@ -24450,7 +24467,7 @@ class Textbox extends IText {
|
|
|
24450
24467
|
rightGap = Math.max(rightGap, maxRight - (v.right || 0));
|
|
24451
24468
|
});
|
|
24452
24469
|
// 计算中心点位置
|
|
24453
|
-
if (maxCenter && minCenter) {
|
|
24470
|
+
if (maxCenter !== null && minCenter !== null) {
|
|
24454
24471
|
const centerOff = maxCenter - minCenter;
|
|
24455
24472
|
const onCharWidth = (lines[maxCharIdx].width || 0) / lines[maxCharIdx].text.length;
|
|
24456
24473
|
// 左边间距大于右边两倍 或者 中心点偏移超过1/2字符且右边间距小于1/3字符
|