microboard-temp 0.14.3 → 0.14.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.
- package/dist/cjs/browser.js +200 -221
- package/dist/cjs/index.js +200 -221
- package/dist/cjs/node.js +200 -221
- package/dist/esm/browser.js +200 -221
- package/dist/esm/index.js +200 -221
- package/dist/esm/node.js +200 -221
- package/dist/types/Items/Group/Group.d.ts +6 -0
- package/package.json +1 -1
package/dist/esm/browser.js
CHANGED
|
@@ -58051,13 +58051,19 @@ var init_findOrthogonalPath = __esm(() => {
|
|
|
58051
58051
|
});
|
|
58052
58052
|
|
|
58053
58053
|
// src/Items/Connector/getLine/getOrthogonalLine.ts
|
|
58054
|
+
function getItemWorldMbr(item) {
|
|
58055
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
58056
|
+
return item.getWorldMbr();
|
|
58057
|
+
}
|
|
58058
|
+
return item.getMbr();
|
|
58059
|
+
}
|
|
58054
58060
|
function getOrthogonalLine(start, end, middle, skipObstacles = false) {
|
|
58055
58061
|
const obstacles = [];
|
|
58056
58062
|
if (start.pointType !== "Board" && !skipObstacles) {
|
|
58057
|
-
obstacles.push(start.item
|
|
58063
|
+
obstacles.push(getItemWorldMbr(start.item));
|
|
58058
58064
|
}
|
|
58059
58065
|
if (end.pointType !== "Board" && !skipObstacles) {
|
|
58060
|
-
obstacles.push(end.item
|
|
58066
|
+
obstacles.push(getItemWorldMbr(end.item));
|
|
58061
58067
|
}
|
|
58062
58068
|
const { lines, newStart, newEnd } = findOrthogonalPath(start, end, obstacles, middle ? [middle] : undefined);
|
|
58063
58069
|
if (lines.length === 0) {
|
|
@@ -58071,6 +58077,7 @@ function getOrthogonalLine(start, end, middle, skipObstacles = false) {
|
|
|
58071
58077
|
var init_getOrthogonalLine = __esm(() => {
|
|
58072
58078
|
init_Items();
|
|
58073
58079
|
init_findOrthogonalPath();
|
|
58080
|
+
init_BaseItem();
|
|
58074
58081
|
});
|
|
58075
58082
|
|
|
58076
58083
|
// src/Items/Connector/getLine/getStraightLine.ts
|
|
@@ -58105,6 +58112,175 @@ var init_getLine = __esm(() => {
|
|
|
58105
58112
|
init_getStraightLine();
|
|
58106
58113
|
});
|
|
58107
58114
|
|
|
58115
|
+
// src/Items/Group/Group.ts
|
|
58116
|
+
var Group;
|
|
58117
|
+
var init_Group = __esm(() => {
|
|
58118
|
+
init_Mbr();
|
|
58119
|
+
init_Point();
|
|
58120
|
+
init_BaseItem();
|
|
58121
|
+
Group = class Group extends BaseItem {
|
|
58122
|
+
events;
|
|
58123
|
+
itemType = "Group";
|
|
58124
|
+
parent = "Board";
|
|
58125
|
+
subject = new Subject;
|
|
58126
|
+
transformationRenderBlock = undefined;
|
|
58127
|
+
isLockedGroup = false;
|
|
58128
|
+
static movingGroupId = null;
|
|
58129
|
+
constructor(board, events, childIds = [], id = "") {
|
|
58130
|
+
super(board, id, undefined, true);
|
|
58131
|
+
this.events = events;
|
|
58132
|
+
this.canBeNested = true;
|
|
58133
|
+
if (childIds.length > 0) {
|
|
58134
|
+
this.applyAddChildren(childIds);
|
|
58135
|
+
}
|
|
58136
|
+
}
|
|
58137
|
+
isClosed() {
|
|
58138
|
+
return false;
|
|
58139
|
+
}
|
|
58140
|
+
getRichText() {
|
|
58141
|
+
return null;
|
|
58142
|
+
}
|
|
58143
|
+
apply(op) {
|
|
58144
|
+
switch (op.class) {
|
|
58145
|
+
case "Transformation":
|
|
58146
|
+
super.apply(op);
|
|
58147
|
+
this.updateMbr();
|
|
58148
|
+
Group.movingGroupId = this.id;
|
|
58149
|
+
for (const child of this.index.listAll()) {
|
|
58150
|
+
child.subject.publish(child);
|
|
58151
|
+
}
|
|
58152
|
+
Group.movingGroupId = null;
|
|
58153
|
+
break;
|
|
58154
|
+
case "Group":
|
|
58155
|
+
if (op.method === "addChild") {
|
|
58156
|
+
this.applyAddChildren([op.childId]);
|
|
58157
|
+
} else if (op.method === "removeChild") {
|
|
58158
|
+
this.applyRemoveChildren([op.childId]);
|
|
58159
|
+
} else {
|
|
58160
|
+
super.apply(op);
|
|
58161
|
+
}
|
|
58162
|
+
break;
|
|
58163
|
+
default:
|
|
58164
|
+
super.apply(op);
|
|
58165
|
+
return;
|
|
58166
|
+
}
|
|
58167
|
+
this.subject.publish(this);
|
|
58168
|
+
}
|
|
58169
|
+
emit(operation) {
|
|
58170
|
+
if (this.events) {
|
|
58171
|
+
const command = new GroupCommand([this], operation);
|
|
58172
|
+
command.apply();
|
|
58173
|
+
this.events.emit(operation, command);
|
|
58174
|
+
} else {
|
|
58175
|
+
this.apply(operation);
|
|
58176
|
+
}
|
|
58177
|
+
}
|
|
58178
|
+
setId(id) {
|
|
58179
|
+
this.id = id;
|
|
58180
|
+
this.transformation.setId(id);
|
|
58181
|
+
return this;
|
|
58182
|
+
}
|
|
58183
|
+
getMbr() {
|
|
58184
|
+
const children = this.index.listAll();
|
|
58185
|
+
if (children.length === 0) {
|
|
58186
|
+
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
58187
|
+
}
|
|
58188
|
+
const groupWorldMatrix = this.getWorldMatrix();
|
|
58189
|
+
let left = Number.MAX_SAFE_INTEGER;
|
|
58190
|
+
let top = Number.MAX_SAFE_INTEGER;
|
|
58191
|
+
let right = Number.MIN_SAFE_INTEGER;
|
|
58192
|
+
let bottom = Number.MIN_SAFE_INTEGER;
|
|
58193
|
+
for (const child of children) {
|
|
58194
|
+
const childLocalMbr = child.getMbr();
|
|
58195
|
+
const corners = [
|
|
58196
|
+
new Point(childLocalMbr.left, childLocalMbr.top),
|
|
58197
|
+
new Point(childLocalMbr.right, childLocalMbr.top),
|
|
58198
|
+
new Point(childLocalMbr.right, childLocalMbr.bottom),
|
|
58199
|
+
new Point(childLocalMbr.left, childLocalMbr.bottom)
|
|
58200
|
+
];
|
|
58201
|
+
for (const corner of corners) {
|
|
58202
|
+
groupWorldMatrix.apply(corner);
|
|
58203
|
+
if (corner.x < left)
|
|
58204
|
+
left = corner.x;
|
|
58205
|
+
if (corner.y < top)
|
|
58206
|
+
top = corner.y;
|
|
58207
|
+
if (corner.x > right)
|
|
58208
|
+
right = corner.x;
|
|
58209
|
+
if (corner.y > bottom)
|
|
58210
|
+
bottom = corner.y;
|
|
58211
|
+
}
|
|
58212
|
+
}
|
|
58213
|
+
const mbr = new Mbr(left, top, right, bottom);
|
|
58214
|
+
this.left = left;
|
|
58215
|
+
this.top = top;
|
|
58216
|
+
this.right = right;
|
|
58217
|
+
this.bottom = bottom;
|
|
58218
|
+
return mbr;
|
|
58219
|
+
}
|
|
58220
|
+
updateMbr() {
|
|
58221
|
+
this.getMbr();
|
|
58222
|
+
}
|
|
58223
|
+
getChildrenIds() {
|
|
58224
|
+
return this.index.listAll().map((item) => item.getId());
|
|
58225
|
+
}
|
|
58226
|
+
getChildren() {
|
|
58227
|
+
return this.index.listAll();
|
|
58228
|
+
}
|
|
58229
|
+
getLinkTo() {
|
|
58230
|
+
return this.linkTo.link;
|
|
58231
|
+
}
|
|
58232
|
+
serialize() {
|
|
58233
|
+
return {
|
|
58234
|
+
id: this.id,
|
|
58235
|
+
itemType: "Group",
|
|
58236
|
+
childIds: this.getChildrenIds(),
|
|
58237
|
+
transformation: this.transformation.serialize(),
|
|
58238
|
+
isLockedGroup: this.isLockedGroup
|
|
58239
|
+
};
|
|
58240
|
+
}
|
|
58241
|
+
deserialize(data) {
|
|
58242
|
+
if (data.transformation) {
|
|
58243
|
+
this.transformation.deserialize(data.transformation);
|
|
58244
|
+
}
|
|
58245
|
+
if (data.childIds && data.childIds.length > 0) {
|
|
58246
|
+
this.applyAddChildren(data.childIds);
|
|
58247
|
+
}
|
|
58248
|
+
if (data.isLockedGroup !== undefined) {
|
|
58249
|
+
this.isLockedGroup = data.isLockedGroup;
|
|
58250
|
+
}
|
|
58251
|
+
this.updateMbr();
|
|
58252
|
+
this.subject.publish(this);
|
|
58253
|
+
return this;
|
|
58254
|
+
}
|
|
58255
|
+
getId() {
|
|
58256
|
+
return this.id;
|
|
58257
|
+
}
|
|
58258
|
+
getIntersectionPoints(segment) {
|
|
58259
|
+
const lines = this.getMbr().getLines();
|
|
58260
|
+
const initPoints = [];
|
|
58261
|
+
return lines.reduce((acc, line) => {
|
|
58262
|
+
const intersections = line.getIntersectionPoints(segment);
|
|
58263
|
+
if (intersections.length > 0) {
|
|
58264
|
+
acc.push(...intersections);
|
|
58265
|
+
}
|
|
58266
|
+
return acc;
|
|
58267
|
+
}, initPoints);
|
|
58268
|
+
}
|
|
58269
|
+
render(context) {
|
|
58270
|
+
if (this.transformationRenderBlock) {
|
|
58271
|
+
return;
|
|
58272
|
+
}
|
|
58273
|
+
const ctx = context.ctx;
|
|
58274
|
+
ctx.save();
|
|
58275
|
+
this.transformation.applyToContext(ctx);
|
|
58276
|
+
for (const child of this.index.listAll()) {
|
|
58277
|
+
child.render(context);
|
|
58278
|
+
}
|
|
58279
|
+
ctx.restore();
|
|
58280
|
+
}
|
|
58281
|
+
};
|
|
58282
|
+
});
|
|
58283
|
+
|
|
58108
58284
|
// src/Items/Connector/ConnectorTypes.ts
|
|
58109
58285
|
var ConnectionLineWidths, CONNECTOR_COLOR = "rgb(20, 21, 26)", CONNECTOR_LINE_WIDTH = 1, CONNECTOR_BORDER_STYLE = "solid", DEFAULT_END_POINTER = "TriangleFilled", CONNECTOR_POINTER_TYPES;
|
|
58110
58286
|
var init_ConnectorTypes = __esm(() => {
|
|
@@ -58213,6 +58389,7 @@ var init_Connector = __esm(() => {
|
|
|
58213
58389
|
init_Settings();
|
|
58214
58390
|
init_transformOps();
|
|
58215
58391
|
init_BaseItem();
|
|
58392
|
+
init_Group();
|
|
58216
58393
|
init_Color();
|
|
58217
58394
|
init_ConnectorTypes();
|
|
58218
58395
|
init_connectorOps();
|
|
@@ -58302,8 +58479,9 @@ var init_Connector = __esm(() => {
|
|
|
58302
58479
|
const point5 = this.startPoint;
|
|
58303
58480
|
if (point5.pointType !== "Board") {
|
|
58304
58481
|
point5.recalculatePoint();
|
|
58305
|
-
const
|
|
58306
|
-
const
|
|
58482
|
+
const isGroupMoving = Group.movingGroupId !== null;
|
|
58483
|
+
const j1 = isGroupMoving ? false : this.smartJumpStartEdge();
|
|
58484
|
+
const j2 = isGroupMoving ? false : this.smartJumpEndEdge();
|
|
58307
58485
|
if (!j1 && !j2) {
|
|
58308
58486
|
this.updatePaths();
|
|
58309
58487
|
this.subject.publish(this);
|
|
@@ -58314,8 +58492,9 @@ var init_Connector = __esm(() => {
|
|
|
58314
58492
|
const point5 = this.endPoint;
|
|
58315
58493
|
if (point5.pointType !== "Board") {
|
|
58316
58494
|
point5.recalculatePoint();
|
|
58317
|
-
const
|
|
58318
|
-
const
|
|
58495
|
+
const isGroupMoving = Group.movingGroupId !== null;
|
|
58496
|
+
const j1 = isGroupMoving ? false : this.smartJumpEndEdge();
|
|
58497
|
+
const j2 = isGroupMoving ? false : this.smartJumpStartEdge();
|
|
58319
58498
|
if (!j1 && !j2) {
|
|
58320
58499
|
this.updatePaths();
|
|
58321
58500
|
this.subject.publish(this);
|
|
@@ -63628,172 +63807,6 @@ var init_Placeholder2 = __esm(() => {
|
|
|
63628
63807
|
init_Placeholder();
|
|
63629
63808
|
});
|
|
63630
63809
|
|
|
63631
|
-
// src/Items/Group/Group.ts
|
|
63632
|
-
var Group;
|
|
63633
|
-
var init_Group = __esm(() => {
|
|
63634
|
-
init_Mbr();
|
|
63635
|
-
init_Point();
|
|
63636
|
-
init_BaseItem();
|
|
63637
|
-
Group = class Group extends BaseItem {
|
|
63638
|
-
events;
|
|
63639
|
-
itemType = "Group";
|
|
63640
|
-
parent = "Board";
|
|
63641
|
-
subject = new Subject;
|
|
63642
|
-
transformationRenderBlock = undefined;
|
|
63643
|
-
isLockedGroup = false;
|
|
63644
|
-
constructor(board, events, childIds = [], id = "") {
|
|
63645
|
-
super(board, id, undefined, true);
|
|
63646
|
-
this.events = events;
|
|
63647
|
-
this.canBeNested = true;
|
|
63648
|
-
if (childIds.length > 0) {
|
|
63649
|
-
this.applyAddChildren(childIds);
|
|
63650
|
-
}
|
|
63651
|
-
}
|
|
63652
|
-
isClosed() {
|
|
63653
|
-
return false;
|
|
63654
|
-
}
|
|
63655
|
-
getRichText() {
|
|
63656
|
-
return null;
|
|
63657
|
-
}
|
|
63658
|
-
apply(op) {
|
|
63659
|
-
switch (op.class) {
|
|
63660
|
-
case "Transformation":
|
|
63661
|
-
super.apply(op);
|
|
63662
|
-
this.updateMbr();
|
|
63663
|
-
for (const child of this.index.listAll()) {
|
|
63664
|
-
child.subject.publish(child);
|
|
63665
|
-
}
|
|
63666
|
-
break;
|
|
63667
|
-
case "Group":
|
|
63668
|
-
if (op.method === "addChild") {
|
|
63669
|
-
this.applyAddChildren([op.childId]);
|
|
63670
|
-
} else if (op.method === "removeChild") {
|
|
63671
|
-
this.applyRemoveChildren([op.childId]);
|
|
63672
|
-
} else {
|
|
63673
|
-
super.apply(op);
|
|
63674
|
-
}
|
|
63675
|
-
break;
|
|
63676
|
-
default:
|
|
63677
|
-
super.apply(op);
|
|
63678
|
-
return;
|
|
63679
|
-
}
|
|
63680
|
-
this.subject.publish(this);
|
|
63681
|
-
}
|
|
63682
|
-
emit(operation) {
|
|
63683
|
-
if (this.events) {
|
|
63684
|
-
const command = new GroupCommand([this], operation);
|
|
63685
|
-
command.apply();
|
|
63686
|
-
this.events.emit(operation, command);
|
|
63687
|
-
} else {
|
|
63688
|
-
this.apply(operation);
|
|
63689
|
-
}
|
|
63690
|
-
}
|
|
63691
|
-
setId(id) {
|
|
63692
|
-
this.id = id;
|
|
63693
|
-
this.transformation.setId(id);
|
|
63694
|
-
return this;
|
|
63695
|
-
}
|
|
63696
|
-
getMbr() {
|
|
63697
|
-
const children = this.index.listAll();
|
|
63698
|
-
if (children.length === 0) {
|
|
63699
|
-
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
63700
|
-
}
|
|
63701
|
-
const groupWorldMatrix = this.getWorldMatrix();
|
|
63702
|
-
let left = Number.MAX_SAFE_INTEGER;
|
|
63703
|
-
let top = Number.MAX_SAFE_INTEGER;
|
|
63704
|
-
let right = Number.MIN_SAFE_INTEGER;
|
|
63705
|
-
let bottom = Number.MIN_SAFE_INTEGER;
|
|
63706
|
-
for (const child of children) {
|
|
63707
|
-
const childLocalMbr = child.getMbr();
|
|
63708
|
-
const corners = [
|
|
63709
|
-
new Point(childLocalMbr.left, childLocalMbr.top),
|
|
63710
|
-
new Point(childLocalMbr.right, childLocalMbr.top),
|
|
63711
|
-
new Point(childLocalMbr.right, childLocalMbr.bottom),
|
|
63712
|
-
new Point(childLocalMbr.left, childLocalMbr.bottom)
|
|
63713
|
-
];
|
|
63714
|
-
for (const corner of corners) {
|
|
63715
|
-
groupWorldMatrix.apply(corner);
|
|
63716
|
-
if (corner.x < left)
|
|
63717
|
-
left = corner.x;
|
|
63718
|
-
if (corner.y < top)
|
|
63719
|
-
top = corner.y;
|
|
63720
|
-
if (corner.x > right)
|
|
63721
|
-
right = corner.x;
|
|
63722
|
-
if (corner.y > bottom)
|
|
63723
|
-
bottom = corner.y;
|
|
63724
|
-
}
|
|
63725
|
-
}
|
|
63726
|
-
const mbr = new Mbr(left, top, right, bottom);
|
|
63727
|
-
this.left = left;
|
|
63728
|
-
this.top = top;
|
|
63729
|
-
this.right = right;
|
|
63730
|
-
this.bottom = bottom;
|
|
63731
|
-
return mbr;
|
|
63732
|
-
}
|
|
63733
|
-
updateMbr() {
|
|
63734
|
-
this.getMbr();
|
|
63735
|
-
}
|
|
63736
|
-
getChildrenIds() {
|
|
63737
|
-
return this.index.listAll().map((item) => item.getId());
|
|
63738
|
-
}
|
|
63739
|
-
getChildren() {
|
|
63740
|
-
return this.index.listAll();
|
|
63741
|
-
}
|
|
63742
|
-
getLinkTo() {
|
|
63743
|
-
return this.linkTo.link;
|
|
63744
|
-
}
|
|
63745
|
-
serialize() {
|
|
63746
|
-
return {
|
|
63747
|
-
id: this.id,
|
|
63748
|
-
itemType: "Group",
|
|
63749
|
-
childIds: this.getChildrenIds(),
|
|
63750
|
-
transformation: this.transformation.serialize(),
|
|
63751
|
-
isLockedGroup: this.isLockedGroup
|
|
63752
|
-
};
|
|
63753
|
-
}
|
|
63754
|
-
deserialize(data) {
|
|
63755
|
-
if (data.transformation) {
|
|
63756
|
-
this.transformation.deserialize(data.transformation);
|
|
63757
|
-
}
|
|
63758
|
-
if (data.childIds && data.childIds.length > 0) {
|
|
63759
|
-
this.applyAddChildren(data.childIds);
|
|
63760
|
-
}
|
|
63761
|
-
if (data.isLockedGroup !== undefined) {
|
|
63762
|
-
this.isLockedGroup = data.isLockedGroup;
|
|
63763
|
-
}
|
|
63764
|
-
this.updateMbr();
|
|
63765
|
-
this.subject.publish(this);
|
|
63766
|
-
return this;
|
|
63767
|
-
}
|
|
63768
|
-
getId() {
|
|
63769
|
-
return this.id;
|
|
63770
|
-
}
|
|
63771
|
-
getIntersectionPoints(segment) {
|
|
63772
|
-
const lines = this.getMbr().getLines();
|
|
63773
|
-
const initPoints = [];
|
|
63774
|
-
return lines.reduce((acc, line) => {
|
|
63775
|
-
const intersections = line.getIntersectionPoints(segment);
|
|
63776
|
-
if (intersections.length > 0) {
|
|
63777
|
-
acc.push(...intersections);
|
|
63778
|
-
}
|
|
63779
|
-
return acc;
|
|
63780
|
-
}, initPoints);
|
|
63781
|
-
}
|
|
63782
|
-
render(context) {
|
|
63783
|
-
if (this.transformationRenderBlock) {
|
|
63784
|
-
return;
|
|
63785
|
-
}
|
|
63786
|
-
const ctx = context.ctx;
|
|
63787
|
-
ctx.save();
|
|
63788
|
-
this.transformation.applyToContext(ctx);
|
|
63789
|
-
for (const child of this.index.listAll()) {
|
|
63790
|
-
child.render(context);
|
|
63791
|
-
}
|
|
63792
|
-
ctx.restore();
|
|
63793
|
-
}
|
|
63794
|
-
};
|
|
63795
|
-
});
|
|
63796
|
-
|
|
63797
63810
|
// src/Items/Group/index.ts
|
|
63798
63811
|
var init_Group2 = __esm(() => {
|
|
63799
63812
|
init_Group();
|
|
@@ -64243,26 +64256,18 @@ class ConnectorSnap {
|
|
|
64243
64256
|
} else if (anchor) {
|
|
64244
64257
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
64245
64258
|
} else if (point5) {
|
|
64246
|
-
|
|
64259
|
+
const nearest2 = item.getNearestEdgePointTo(pointer);
|
|
64260
|
+
this.controlPoint = getFixedPoint(item, nearest2);
|
|
64247
64261
|
} else {
|
|
64248
|
-
this.
|
|
64262
|
+
if (this.hover.isTimeoutElapsed) {
|
|
64263
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
64264
|
+
} else {
|
|
64265
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
64266
|
+
}
|
|
64249
64267
|
}
|
|
64250
64268
|
}
|
|
64251
64269
|
setHover() {
|
|
64252
|
-
|
|
64253
|
-
if (hover instanceof BaseItem && hover.index) {
|
|
64254
|
-
const group = hover;
|
|
64255
|
-
const inverse = group.getWorldMatrix().getInverse();
|
|
64256
|
-
const pointer = this.board.pointer.point;
|
|
64257
|
-
const localPointer = pointer.copy();
|
|
64258
|
-
localPointer.transform(inverse);
|
|
64259
|
-
for (const child of group.index.listAll()) {
|
|
64260
|
-
if (child.getMbr().isUnderPoint(localPointer)) {
|
|
64261
|
-
hover = child;
|
|
64262
|
-
break;
|
|
64263
|
-
}
|
|
64264
|
-
}
|
|
64265
|
-
}
|
|
64270
|
+
const hover = this.board.items.getUnderPointer(0)[0];
|
|
64266
64271
|
if (hover) {
|
|
64267
64272
|
if (hover !== this.hover.item) {
|
|
64268
64273
|
this.hover = {
|
|
@@ -64319,18 +64324,8 @@ class ConnectorSnap {
|
|
|
64319
64324
|
return nearest;
|
|
64320
64325
|
}
|
|
64321
64326
|
getClosestPointOnItem(item, position4) {
|
|
64322
|
-
|
|
64323
|
-
|
|
64324
|
-
const parentMatrix = item.getParentWorldMatrix();
|
|
64325
|
-
const localPos = position4.copy();
|
|
64326
|
-
localPos.transform(parentMatrix.getInverse());
|
|
64327
|
-
const localEdge = item.getNearestEdgePointTo(localPos);
|
|
64328
|
-
worldEdgePoint = localEdge.copy();
|
|
64329
|
-
parentMatrix.apply(worldEdgePoint);
|
|
64330
|
-
} else {
|
|
64331
|
-
worldEdgePoint = item.getNearestEdgePointTo(position4);
|
|
64332
|
-
}
|
|
64333
|
-
return getFixedPoint(item, worldEdgePoint);
|
|
64327
|
+
const nearestEdgePoint = item.getNearestEdgePointTo(position4);
|
|
64328
|
+
return getFixedPoint(item, nearestEdgePoint);
|
|
64334
64329
|
}
|
|
64335
64330
|
isNearBorder(item) {
|
|
64336
64331
|
if (!item) {
|
|
@@ -64359,15 +64354,10 @@ class ConnectorSnap {
|
|
|
64359
64354
|
}
|
|
64360
64355
|
}
|
|
64361
64356
|
setAnchors(item) {
|
|
64362
|
-
const
|
|
64363
|
-
if (!
|
|
64357
|
+
const points = item.getSnapAnchorPoints();
|
|
64358
|
+
if (!points) {
|
|
64364
64359
|
return;
|
|
64365
64360
|
}
|
|
64366
|
-
const points = item instanceof BaseItem && item.parent !== "Board" ? localPoints.map((p3) => {
|
|
64367
|
-
const wp = p3.copy();
|
|
64368
|
-
item.getParentWorldMatrix().apply(wp);
|
|
64369
|
-
return wp;
|
|
64370
|
-
}) : localPoints;
|
|
64371
64361
|
const anchors = [];
|
|
64372
64362
|
for (const { x, y } of points) {
|
|
64373
64363
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -64401,19 +64391,9 @@ class ConnectorSnap {
|
|
|
64401
64391
|
const { item, anchor } = this.snap;
|
|
64402
64392
|
if (item) {
|
|
64403
64393
|
if (!anchor) {
|
|
64404
|
-
|
|
64405
|
-
if (
|
|
64406
|
-
|
|
64407
|
-
const localPointer = pointer.copy();
|
|
64408
|
-
localPointer.transform(parentMatrix.getInverse());
|
|
64409
|
-
const localEdge = item.getNearestEdgePointTo(localPointer);
|
|
64410
|
-
edgePoint = localEdge.copy();
|
|
64411
|
-
parentMatrix.apply(edgePoint);
|
|
64412
|
-
} else {
|
|
64413
|
-
edgePoint = item.getNearestEdgePointTo(pointer);
|
|
64414
|
-
}
|
|
64415
|
-
if (edgePoint.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
|
|
64416
|
-
this.snap.point = new Anchor(edgePoint.x, edgePoint.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
|
|
64394
|
+
const point5 = item.getNearestEdgePointTo(pointer);
|
|
64395
|
+
if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
|
|
64396
|
+
this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
|
|
64417
64397
|
} else {
|
|
64418
64398
|
this.snap.point = null;
|
|
64419
64399
|
}
|
|
@@ -64442,7 +64422,6 @@ class ConnectorSnap {
|
|
|
64442
64422
|
}
|
|
64443
64423
|
var init_ConnectorSnap = __esm(() => {
|
|
64444
64424
|
init_ControlPoint();
|
|
64445
|
-
init_BaseItem2();
|
|
64446
64425
|
init_Anchor2();
|
|
64447
64426
|
init_Connector();
|
|
64448
64427
|
});
|