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/cjs/node.js
CHANGED
|
@@ -60534,13 +60534,19 @@ var init_findOrthogonalPath = __esm(() => {
|
|
|
60534
60534
|
});
|
|
60535
60535
|
|
|
60536
60536
|
// src/Items/Connector/getLine/getOrthogonalLine.ts
|
|
60537
|
+
function getItemWorldMbr(item) {
|
|
60538
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
60539
|
+
return item.getWorldMbr();
|
|
60540
|
+
}
|
|
60541
|
+
return item.getMbr();
|
|
60542
|
+
}
|
|
60537
60543
|
function getOrthogonalLine(start, end, middle, skipObstacles = false) {
|
|
60538
60544
|
const obstacles = [];
|
|
60539
60545
|
if (start.pointType !== "Board" && !skipObstacles) {
|
|
60540
|
-
obstacles.push(start.item
|
|
60546
|
+
obstacles.push(getItemWorldMbr(start.item));
|
|
60541
60547
|
}
|
|
60542
60548
|
if (end.pointType !== "Board" && !skipObstacles) {
|
|
60543
|
-
obstacles.push(end.item
|
|
60549
|
+
obstacles.push(getItemWorldMbr(end.item));
|
|
60544
60550
|
}
|
|
60545
60551
|
const { lines, newStart, newEnd } = findOrthogonalPath(start, end, obstacles, middle ? [middle] : undefined);
|
|
60546
60552
|
if (lines.length === 0) {
|
|
@@ -60554,6 +60560,7 @@ function getOrthogonalLine(start, end, middle, skipObstacles = false) {
|
|
|
60554
60560
|
var init_getOrthogonalLine = __esm(() => {
|
|
60555
60561
|
init_Items();
|
|
60556
60562
|
init_findOrthogonalPath();
|
|
60563
|
+
init_BaseItem();
|
|
60557
60564
|
});
|
|
60558
60565
|
|
|
60559
60566
|
// src/Items/Connector/getLine/getStraightLine.ts
|
|
@@ -60588,6 +60595,175 @@ var init_getLine = __esm(() => {
|
|
|
60588
60595
|
init_getStraightLine();
|
|
60589
60596
|
});
|
|
60590
60597
|
|
|
60598
|
+
// src/Items/Group/Group.ts
|
|
60599
|
+
var Group;
|
|
60600
|
+
var init_Group = __esm(() => {
|
|
60601
|
+
init_Mbr();
|
|
60602
|
+
init_Point();
|
|
60603
|
+
init_BaseItem();
|
|
60604
|
+
Group = class Group extends BaseItem {
|
|
60605
|
+
events;
|
|
60606
|
+
itemType = "Group";
|
|
60607
|
+
parent = "Board";
|
|
60608
|
+
subject = new Subject;
|
|
60609
|
+
transformationRenderBlock = undefined;
|
|
60610
|
+
isLockedGroup = false;
|
|
60611
|
+
static movingGroupId = null;
|
|
60612
|
+
constructor(board, events, childIds = [], id = "") {
|
|
60613
|
+
super(board, id, undefined, true);
|
|
60614
|
+
this.events = events;
|
|
60615
|
+
this.canBeNested = true;
|
|
60616
|
+
if (childIds.length > 0) {
|
|
60617
|
+
this.applyAddChildren(childIds);
|
|
60618
|
+
}
|
|
60619
|
+
}
|
|
60620
|
+
isClosed() {
|
|
60621
|
+
return false;
|
|
60622
|
+
}
|
|
60623
|
+
getRichText() {
|
|
60624
|
+
return null;
|
|
60625
|
+
}
|
|
60626
|
+
apply(op) {
|
|
60627
|
+
switch (op.class) {
|
|
60628
|
+
case "Transformation":
|
|
60629
|
+
super.apply(op);
|
|
60630
|
+
this.updateMbr();
|
|
60631
|
+
Group.movingGroupId = this.id;
|
|
60632
|
+
for (const child of this.index.listAll()) {
|
|
60633
|
+
child.subject.publish(child);
|
|
60634
|
+
}
|
|
60635
|
+
Group.movingGroupId = null;
|
|
60636
|
+
break;
|
|
60637
|
+
case "Group":
|
|
60638
|
+
if (op.method === "addChild") {
|
|
60639
|
+
this.applyAddChildren([op.childId]);
|
|
60640
|
+
} else if (op.method === "removeChild") {
|
|
60641
|
+
this.applyRemoveChildren([op.childId]);
|
|
60642
|
+
} else {
|
|
60643
|
+
super.apply(op);
|
|
60644
|
+
}
|
|
60645
|
+
break;
|
|
60646
|
+
default:
|
|
60647
|
+
super.apply(op);
|
|
60648
|
+
return;
|
|
60649
|
+
}
|
|
60650
|
+
this.subject.publish(this);
|
|
60651
|
+
}
|
|
60652
|
+
emit(operation) {
|
|
60653
|
+
if (this.events) {
|
|
60654
|
+
const command = new GroupCommand([this], operation);
|
|
60655
|
+
command.apply();
|
|
60656
|
+
this.events.emit(operation, command);
|
|
60657
|
+
} else {
|
|
60658
|
+
this.apply(operation);
|
|
60659
|
+
}
|
|
60660
|
+
}
|
|
60661
|
+
setId(id) {
|
|
60662
|
+
this.id = id;
|
|
60663
|
+
this.transformation.setId(id);
|
|
60664
|
+
return this;
|
|
60665
|
+
}
|
|
60666
|
+
getMbr() {
|
|
60667
|
+
const children = this.index.listAll();
|
|
60668
|
+
if (children.length === 0) {
|
|
60669
|
+
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
60670
|
+
}
|
|
60671
|
+
const groupWorldMatrix = this.getWorldMatrix();
|
|
60672
|
+
let left = Number.MAX_SAFE_INTEGER;
|
|
60673
|
+
let top = Number.MAX_SAFE_INTEGER;
|
|
60674
|
+
let right = Number.MIN_SAFE_INTEGER;
|
|
60675
|
+
let bottom = Number.MIN_SAFE_INTEGER;
|
|
60676
|
+
for (const child of children) {
|
|
60677
|
+
const childLocalMbr = child.getMbr();
|
|
60678
|
+
const corners = [
|
|
60679
|
+
new Point(childLocalMbr.left, childLocalMbr.top),
|
|
60680
|
+
new Point(childLocalMbr.right, childLocalMbr.top),
|
|
60681
|
+
new Point(childLocalMbr.right, childLocalMbr.bottom),
|
|
60682
|
+
new Point(childLocalMbr.left, childLocalMbr.bottom)
|
|
60683
|
+
];
|
|
60684
|
+
for (const corner of corners) {
|
|
60685
|
+
groupWorldMatrix.apply(corner);
|
|
60686
|
+
if (corner.x < left)
|
|
60687
|
+
left = corner.x;
|
|
60688
|
+
if (corner.y < top)
|
|
60689
|
+
top = corner.y;
|
|
60690
|
+
if (corner.x > right)
|
|
60691
|
+
right = corner.x;
|
|
60692
|
+
if (corner.y > bottom)
|
|
60693
|
+
bottom = corner.y;
|
|
60694
|
+
}
|
|
60695
|
+
}
|
|
60696
|
+
const mbr = new Mbr(left, top, right, bottom);
|
|
60697
|
+
this.left = left;
|
|
60698
|
+
this.top = top;
|
|
60699
|
+
this.right = right;
|
|
60700
|
+
this.bottom = bottom;
|
|
60701
|
+
return mbr;
|
|
60702
|
+
}
|
|
60703
|
+
updateMbr() {
|
|
60704
|
+
this.getMbr();
|
|
60705
|
+
}
|
|
60706
|
+
getChildrenIds() {
|
|
60707
|
+
return this.index.listAll().map((item) => item.getId());
|
|
60708
|
+
}
|
|
60709
|
+
getChildren() {
|
|
60710
|
+
return this.index.listAll();
|
|
60711
|
+
}
|
|
60712
|
+
getLinkTo() {
|
|
60713
|
+
return this.linkTo.link;
|
|
60714
|
+
}
|
|
60715
|
+
serialize() {
|
|
60716
|
+
return {
|
|
60717
|
+
id: this.id,
|
|
60718
|
+
itemType: "Group",
|
|
60719
|
+
childIds: this.getChildrenIds(),
|
|
60720
|
+
transformation: this.transformation.serialize(),
|
|
60721
|
+
isLockedGroup: this.isLockedGroup
|
|
60722
|
+
};
|
|
60723
|
+
}
|
|
60724
|
+
deserialize(data) {
|
|
60725
|
+
if (data.transformation) {
|
|
60726
|
+
this.transformation.deserialize(data.transformation);
|
|
60727
|
+
}
|
|
60728
|
+
if (data.childIds && data.childIds.length > 0) {
|
|
60729
|
+
this.applyAddChildren(data.childIds);
|
|
60730
|
+
}
|
|
60731
|
+
if (data.isLockedGroup !== undefined) {
|
|
60732
|
+
this.isLockedGroup = data.isLockedGroup;
|
|
60733
|
+
}
|
|
60734
|
+
this.updateMbr();
|
|
60735
|
+
this.subject.publish(this);
|
|
60736
|
+
return this;
|
|
60737
|
+
}
|
|
60738
|
+
getId() {
|
|
60739
|
+
return this.id;
|
|
60740
|
+
}
|
|
60741
|
+
getIntersectionPoints(segment) {
|
|
60742
|
+
const lines = this.getMbr().getLines();
|
|
60743
|
+
const initPoints = [];
|
|
60744
|
+
return lines.reduce((acc, line) => {
|
|
60745
|
+
const intersections = line.getIntersectionPoints(segment);
|
|
60746
|
+
if (intersections.length > 0) {
|
|
60747
|
+
acc.push(...intersections);
|
|
60748
|
+
}
|
|
60749
|
+
return acc;
|
|
60750
|
+
}, initPoints);
|
|
60751
|
+
}
|
|
60752
|
+
render(context) {
|
|
60753
|
+
if (this.transformationRenderBlock) {
|
|
60754
|
+
return;
|
|
60755
|
+
}
|
|
60756
|
+
const ctx = context.ctx;
|
|
60757
|
+
ctx.save();
|
|
60758
|
+
this.transformation.applyToContext(ctx);
|
|
60759
|
+
for (const child of this.index.listAll()) {
|
|
60760
|
+
child.render(context);
|
|
60761
|
+
}
|
|
60762
|
+
ctx.restore();
|
|
60763
|
+
}
|
|
60764
|
+
};
|
|
60765
|
+
});
|
|
60766
|
+
|
|
60591
60767
|
// src/Items/Connector/ConnectorTypes.ts
|
|
60592
60768
|
var ConnectionLineWidths, CONNECTOR_COLOR = "rgb(20, 21, 26)", CONNECTOR_LINE_WIDTH = 1, CONNECTOR_BORDER_STYLE = "solid", DEFAULT_END_POINTER = "TriangleFilled", CONNECTOR_POINTER_TYPES;
|
|
60593
60769
|
var init_ConnectorTypes = __esm(() => {
|
|
@@ -60696,6 +60872,7 @@ var init_Connector = __esm(() => {
|
|
|
60696
60872
|
init_Settings();
|
|
60697
60873
|
init_transformOps();
|
|
60698
60874
|
init_BaseItem();
|
|
60875
|
+
init_Group();
|
|
60699
60876
|
init_Color();
|
|
60700
60877
|
init_ConnectorTypes();
|
|
60701
60878
|
init_connectorOps();
|
|
@@ -60785,8 +60962,9 @@ var init_Connector = __esm(() => {
|
|
|
60785
60962
|
const point5 = this.startPoint;
|
|
60786
60963
|
if (point5.pointType !== "Board") {
|
|
60787
60964
|
point5.recalculatePoint();
|
|
60788
|
-
const
|
|
60789
|
-
const
|
|
60965
|
+
const isGroupMoving = Group.movingGroupId !== null;
|
|
60966
|
+
const j1 = isGroupMoving ? false : this.smartJumpStartEdge();
|
|
60967
|
+
const j2 = isGroupMoving ? false : this.smartJumpEndEdge();
|
|
60790
60968
|
if (!j1 && !j2) {
|
|
60791
60969
|
this.updatePaths();
|
|
60792
60970
|
this.subject.publish(this);
|
|
@@ -60797,8 +60975,9 @@ var init_Connector = __esm(() => {
|
|
|
60797
60975
|
const point5 = this.endPoint;
|
|
60798
60976
|
if (point5.pointType !== "Board") {
|
|
60799
60977
|
point5.recalculatePoint();
|
|
60800
|
-
const
|
|
60801
|
-
const
|
|
60978
|
+
const isGroupMoving = Group.movingGroupId !== null;
|
|
60979
|
+
const j1 = isGroupMoving ? false : this.smartJumpEndEdge();
|
|
60980
|
+
const j2 = isGroupMoving ? false : this.smartJumpStartEdge();
|
|
60802
60981
|
if (!j1 && !j2) {
|
|
60803
60982
|
this.updatePaths();
|
|
60804
60983
|
this.subject.publish(this);
|
|
@@ -66111,172 +66290,6 @@ var init_Placeholder2 = __esm(() => {
|
|
|
66111
66290
|
init_Placeholder();
|
|
66112
66291
|
});
|
|
66113
66292
|
|
|
66114
|
-
// src/Items/Group/Group.ts
|
|
66115
|
-
var Group;
|
|
66116
|
-
var init_Group = __esm(() => {
|
|
66117
|
-
init_Mbr();
|
|
66118
|
-
init_Point();
|
|
66119
|
-
init_BaseItem();
|
|
66120
|
-
Group = class Group extends BaseItem {
|
|
66121
|
-
events;
|
|
66122
|
-
itemType = "Group";
|
|
66123
|
-
parent = "Board";
|
|
66124
|
-
subject = new Subject;
|
|
66125
|
-
transformationRenderBlock = undefined;
|
|
66126
|
-
isLockedGroup = false;
|
|
66127
|
-
constructor(board, events, childIds = [], id = "") {
|
|
66128
|
-
super(board, id, undefined, true);
|
|
66129
|
-
this.events = events;
|
|
66130
|
-
this.canBeNested = true;
|
|
66131
|
-
if (childIds.length > 0) {
|
|
66132
|
-
this.applyAddChildren(childIds);
|
|
66133
|
-
}
|
|
66134
|
-
}
|
|
66135
|
-
isClosed() {
|
|
66136
|
-
return false;
|
|
66137
|
-
}
|
|
66138
|
-
getRichText() {
|
|
66139
|
-
return null;
|
|
66140
|
-
}
|
|
66141
|
-
apply(op) {
|
|
66142
|
-
switch (op.class) {
|
|
66143
|
-
case "Transformation":
|
|
66144
|
-
super.apply(op);
|
|
66145
|
-
this.updateMbr();
|
|
66146
|
-
for (const child of this.index.listAll()) {
|
|
66147
|
-
child.subject.publish(child);
|
|
66148
|
-
}
|
|
66149
|
-
break;
|
|
66150
|
-
case "Group":
|
|
66151
|
-
if (op.method === "addChild") {
|
|
66152
|
-
this.applyAddChildren([op.childId]);
|
|
66153
|
-
} else if (op.method === "removeChild") {
|
|
66154
|
-
this.applyRemoveChildren([op.childId]);
|
|
66155
|
-
} else {
|
|
66156
|
-
super.apply(op);
|
|
66157
|
-
}
|
|
66158
|
-
break;
|
|
66159
|
-
default:
|
|
66160
|
-
super.apply(op);
|
|
66161
|
-
return;
|
|
66162
|
-
}
|
|
66163
|
-
this.subject.publish(this);
|
|
66164
|
-
}
|
|
66165
|
-
emit(operation) {
|
|
66166
|
-
if (this.events) {
|
|
66167
|
-
const command = new GroupCommand([this], operation);
|
|
66168
|
-
command.apply();
|
|
66169
|
-
this.events.emit(operation, command);
|
|
66170
|
-
} else {
|
|
66171
|
-
this.apply(operation);
|
|
66172
|
-
}
|
|
66173
|
-
}
|
|
66174
|
-
setId(id) {
|
|
66175
|
-
this.id = id;
|
|
66176
|
-
this.transformation.setId(id);
|
|
66177
|
-
return this;
|
|
66178
|
-
}
|
|
66179
|
-
getMbr() {
|
|
66180
|
-
const children = this.index.listAll();
|
|
66181
|
-
if (children.length === 0) {
|
|
66182
|
-
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
66183
|
-
}
|
|
66184
|
-
const groupWorldMatrix = this.getWorldMatrix();
|
|
66185
|
-
let left = Number.MAX_SAFE_INTEGER;
|
|
66186
|
-
let top = Number.MAX_SAFE_INTEGER;
|
|
66187
|
-
let right = Number.MIN_SAFE_INTEGER;
|
|
66188
|
-
let bottom = Number.MIN_SAFE_INTEGER;
|
|
66189
|
-
for (const child of children) {
|
|
66190
|
-
const childLocalMbr = child.getMbr();
|
|
66191
|
-
const corners = [
|
|
66192
|
-
new Point(childLocalMbr.left, childLocalMbr.top),
|
|
66193
|
-
new Point(childLocalMbr.right, childLocalMbr.top),
|
|
66194
|
-
new Point(childLocalMbr.right, childLocalMbr.bottom),
|
|
66195
|
-
new Point(childLocalMbr.left, childLocalMbr.bottom)
|
|
66196
|
-
];
|
|
66197
|
-
for (const corner of corners) {
|
|
66198
|
-
groupWorldMatrix.apply(corner);
|
|
66199
|
-
if (corner.x < left)
|
|
66200
|
-
left = corner.x;
|
|
66201
|
-
if (corner.y < top)
|
|
66202
|
-
top = corner.y;
|
|
66203
|
-
if (corner.x > right)
|
|
66204
|
-
right = corner.x;
|
|
66205
|
-
if (corner.y > bottom)
|
|
66206
|
-
bottom = corner.y;
|
|
66207
|
-
}
|
|
66208
|
-
}
|
|
66209
|
-
const mbr = new Mbr(left, top, right, bottom);
|
|
66210
|
-
this.left = left;
|
|
66211
|
-
this.top = top;
|
|
66212
|
-
this.right = right;
|
|
66213
|
-
this.bottom = bottom;
|
|
66214
|
-
return mbr;
|
|
66215
|
-
}
|
|
66216
|
-
updateMbr() {
|
|
66217
|
-
this.getMbr();
|
|
66218
|
-
}
|
|
66219
|
-
getChildrenIds() {
|
|
66220
|
-
return this.index.listAll().map((item) => item.getId());
|
|
66221
|
-
}
|
|
66222
|
-
getChildren() {
|
|
66223
|
-
return this.index.listAll();
|
|
66224
|
-
}
|
|
66225
|
-
getLinkTo() {
|
|
66226
|
-
return this.linkTo.link;
|
|
66227
|
-
}
|
|
66228
|
-
serialize() {
|
|
66229
|
-
return {
|
|
66230
|
-
id: this.id,
|
|
66231
|
-
itemType: "Group",
|
|
66232
|
-
childIds: this.getChildrenIds(),
|
|
66233
|
-
transformation: this.transformation.serialize(),
|
|
66234
|
-
isLockedGroup: this.isLockedGroup
|
|
66235
|
-
};
|
|
66236
|
-
}
|
|
66237
|
-
deserialize(data) {
|
|
66238
|
-
if (data.transformation) {
|
|
66239
|
-
this.transformation.deserialize(data.transformation);
|
|
66240
|
-
}
|
|
66241
|
-
if (data.childIds && data.childIds.length > 0) {
|
|
66242
|
-
this.applyAddChildren(data.childIds);
|
|
66243
|
-
}
|
|
66244
|
-
if (data.isLockedGroup !== undefined) {
|
|
66245
|
-
this.isLockedGroup = data.isLockedGroup;
|
|
66246
|
-
}
|
|
66247
|
-
this.updateMbr();
|
|
66248
|
-
this.subject.publish(this);
|
|
66249
|
-
return this;
|
|
66250
|
-
}
|
|
66251
|
-
getId() {
|
|
66252
|
-
return this.id;
|
|
66253
|
-
}
|
|
66254
|
-
getIntersectionPoints(segment) {
|
|
66255
|
-
const lines = this.getMbr().getLines();
|
|
66256
|
-
const initPoints = [];
|
|
66257
|
-
return lines.reduce((acc, line) => {
|
|
66258
|
-
const intersections = line.getIntersectionPoints(segment);
|
|
66259
|
-
if (intersections.length > 0) {
|
|
66260
|
-
acc.push(...intersections);
|
|
66261
|
-
}
|
|
66262
|
-
return acc;
|
|
66263
|
-
}, initPoints);
|
|
66264
|
-
}
|
|
66265
|
-
render(context) {
|
|
66266
|
-
if (this.transformationRenderBlock) {
|
|
66267
|
-
return;
|
|
66268
|
-
}
|
|
66269
|
-
const ctx = context.ctx;
|
|
66270
|
-
ctx.save();
|
|
66271
|
-
this.transformation.applyToContext(ctx);
|
|
66272
|
-
for (const child of this.index.listAll()) {
|
|
66273
|
-
child.render(context);
|
|
66274
|
-
}
|
|
66275
|
-
ctx.restore();
|
|
66276
|
-
}
|
|
66277
|
-
};
|
|
66278
|
-
});
|
|
66279
|
-
|
|
66280
66293
|
// src/Items/Group/index.ts
|
|
66281
66294
|
var init_Group2 = __esm(() => {
|
|
66282
66295
|
init_Group();
|
|
@@ -66726,26 +66739,18 @@ class ConnectorSnap {
|
|
|
66726
66739
|
} else if (anchor) {
|
|
66727
66740
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
66728
66741
|
} else if (point5) {
|
|
66729
|
-
|
|
66742
|
+
const nearest2 = item.getNearestEdgePointTo(pointer);
|
|
66743
|
+
this.controlPoint = getFixedPoint(item, nearest2);
|
|
66730
66744
|
} else {
|
|
66731
|
-
this.
|
|
66745
|
+
if (this.hover.isTimeoutElapsed) {
|
|
66746
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
66747
|
+
} else {
|
|
66748
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
66749
|
+
}
|
|
66732
66750
|
}
|
|
66733
66751
|
}
|
|
66734
66752
|
setHover() {
|
|
66735
|
-
|
|
66736
|
-
if (hover instanceof BaseItem && hover.index) {
|
|
66737
|
-
const group = hover;
|
|
66738
|
-
const inverse = group.getWorldMatrix().getInverse();
|
|
66739
|
-
const pointer = this.board.pointer.point;
|
|
66740
|
-
const localPointer = pointer.copy();
|
|
66741
|
-
localPointer.transform(inverse);
|
|
66742
|
-
for (const child of group.index.listAll()) {
|
|
66743
|
-
if (child.getMbr().isUnderPoint(localPointer)) {
|
|
66744
|
-
hover = child;
|
|
66745
|
-
break;
|
|
66746
|
-
}
|
|
66747
|
-
}
|
|
66748
|
-
}
|
|
66753
|
+
const hover = this.board.items.getUnderPointer(0)[0];
|
|
66749
66754
|
if (hover) {
|
|
66750
66755
|
if (hover !== this.hover.item) {
|
|
66751
66756
|
this.hover = {
|
|
@@ -66802,18 +66807,8 @@ class ConnectorSnap {
|
|
|
66802
66807
|
return nearest;
|
|
66803
66808
|
}
|
|
66804
66809
|
getClosestPointOnItem(item, position4) {
|
|
66805
|
-
|
|
66806
|
-
|
|
66807
|
-
const parentMatrix = item.getParentWorldMatrix();
|
|
66808
|
-
const localPos = position4.copy();
|
|
66809
|
-
localPos.transform(parentMatrix.getInverse());
|
|
66810
|
-
const localEdge = item.getNearestEdgePointTo(localPos);
|
|
66811
|
-
worldEdgePoint = localEdge.copy();
|
|
66812
|
-
parentMatrix.apply(worldEdgePoint);
|
|
66813
|
-
} else {
|
|
66814
|
-
worldEdgePoint = item.getNearestEdgePointTo(position4);
|
|
66815
|
-
}
|
|
66816
|
-
return getFixedPoint(item, worldEdgePoint);
|
|
66810
|
+
const nearestEdgePoint = item.getNearestEdgePointTo(position4);
|
|
66811
|
+
return getFixedPoint(item, nearestEdgePoint);
|
|
66817
66812
|
}
|
|
66818
66813
|
isNearBorder(item) {
|
|
66819
66814
|
if (!item) {
|
|
@@ -66842,15 +66837,10 @@ class ConnectorSnap {
|
|
|
66842
66837
|
}
|
|
66843
66838
|
}
|
|
66844
66839
|
setAnchors(item) {
|
|
66845
|
-
const
|
|
66846
|
-
if (!
|
|
66840
|
+
const points = item.getSnapAnchorPoints();
|
|
66841
|
+
if (!points) {
|
|
66847
66842
|
return;
|
|
66848
66843
|
}
|
|
66849
|
-
const points = item instanceof BaseItem && item.parent !== "Board" ? localPoints.map((p3) => {
|
|
66850
|
-
const wp = p3.copy();
|
|
66851
|
-
item.getParentWorldMatrix().apply(wp);
|
|
66852
|
-
return wp;
|
|
66853
|
-
}) : localPoints;
|
|
66854
66844
|
const anchors = [];
|
|
66855
66845
|
for (const { x, y } of points) {
|
|
66856
66846
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -66884,19 +66874,9 @@ class ConnectorSnap {
|
|
|
66884
66874
|
const { item, anchor } = this.snap;
|
|
66885
66875
|
if (item) {
|
|
66886
66876
|
if (!anchor) {
|
|
66887
|
-
|
|
66888
|
-
if (
|
|
66889
|
-
|
|
66890
|
-
const localPointer = pointer.copy();
|
|
66891
|
-
localPointer.transform(parentMatrix.getInverse());
|
|
66892
|
-
const localEdge = item.getNearestEdgePointTo(localPointer);
|
|
66893
|
-
edgePoint = localEdge.copy();
|
|
66894
|
-
parentMatrix.apply(edgePoint);
|
|
66895
|
-
} else {
|
|
66896
|
-
edgePoint = item.getNearestEdgePointTo(pointer);
|
|
66897
|
-
}
|
|
66898
|
-
if (edgePoint.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
|
|
66899
|
-
this.snap.point = new Anchor(edgePoint.x, edgePoint.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
|
|
66877
|
+
const point5 = item.getNearestEdgePointTo(pointer);
|
|
66878
|
+
if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
|
|
66879
|
+
this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
|
|
66900
66880
|
} else {
|
|
66901
66881
|
this.snap.point = null;
|
|
66902
66882
|
}
|
|
@@ -66925,7 +66905,6 @@ class ConnectorSnap {
|
|
|
66925
66905
|
}
|
|
66926
66906
|
var init_ConnectorSnap = __esm(() => {
|
|
66927
66907
|
init_ControlPoint();
|
|
66928
|
-
init_BaseItem2();
|
|
66929
66908
|
init_Anchor2();
|
|
66930
66909
|
init_Connector();
|
|
66931
66910
|
});
|