microboard-temp 0.14.2 → 0.14.3
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 +68 -21
- package/dist/cjs/index.js +68 -21
- package/dist/cjs/node.js +68 -21
- package/dist/esm/browser.js +68 -21
- package/dist/esm/index.js +68 -21
- package/dist/esm/node.js +68 -21
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -58392,14 +58392,19 @@ var init_Connector = __esm(() => {
|
|
|
58392
58392
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
58393
58393
|
return false;
|
|
58394
58394
|
const item = start.item;
|
|
58395
|
-
const
|
|
58396
|
-
if (!
|
|
58395
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
58396
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
58397
58397
|
return false;
|
|
58398
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
58399
|
+
const p3 = a2.copy();
|
|
58400
|
+
item.getParentWorldMatrix().apply(p3);
|
|
58401
|
+
return p3;
|
|
58402
|
+
}) : localAnchors;
|
|
58398
58403
|
const EPS = 2;
|
|
58399
58404
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
58400
58405
|
if (!isOnAnchor)
|
|
58401
58406
|
return false;
|
|
58402
|
-
const center = item.getMbr().getCenter();
|
|
58407
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
58403
58408
|
const dx = this.endPoint.x - center.x;
|
|
58404
58409
|
const dy = this.endPoint.y - center.y;
|
|
58405
58410
|
if (dx === 0 && dy === 0)
|
|
@@ -58430,14 +58435,19 @@ var init_Connector = __esm(() => {
|
|
|
58430
58435
|
if (end.pointType !== "Fixed" && end.pointType !== "Floating")
|
|
58431
58436
|
return false;
|
|
58432
58437
|
const item = end.item;
|
|
58433
|
-
const
|
|
58434
|
-
if (!
|
|
58438
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
58439
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
58435
58440
|
return false;
|
|
58441
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
58442
|
+
const p3 = a2.copy();
|
|
58443
|
+
item.getParentWorldMatrix().apply(p3);
|
|
58444
|
+
return p3;
|
|
58445
|
+
}) : localAnchors;
|
|
58436
58446
|
const EPS = 2;
|
|
58437
58447
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - end.x) < EPS && Math.abs(a2.y - end.y) < EPS);
|
|
58438
58448
|
if (!isOnAnchor)
|
|
58439
58449
|
return false;
|
|
58440
|
-
const center = item.getMbr().getCenter();
|
|
58450
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
58441
58451
|
const dx = this.startPoint.x - center.x;
|
|
58442
58452
|
const dy = this.startPoint.y - center.y;
|
|
58443
58453
|
if (dx === 0 && dy === 0)
|
|
@@ -63713,6 +63723,9 @@ var init_Group = __esm(() => {
|
|
|
63713
63723
|
case "Transformation":
|
|
63714
63724
|
super.apply(op);
|
|
63715
63725
|
this.updateMbr();
|
|
63726
|
+
for (const child of this.index.listAll()) {
|
|
63727
|
+
child.subject.publish(child);
|
|
63728
|
+
}
|
|
63716
63729
|
break;
|
|
63717
63730
|
case "Group":
|
|
63718
63731
|
if (op.method === "addChild") {
|
|
@@ -64293,18 +64306,26 @@ class ConnectorSnap {
|
|
|
64293
64306
|
} else if (anchor) {
|
|
64294
64307
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
64295
64308
|
} else if (point5) {
|
|
64296
|
-
|
|
64297
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
64309
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
64298
64310
|
} else {
|
|
64299
|
-
|
|
64300
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64301
|
-
} else {
|
|
64302
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64303
|
-
}
|
|
64311
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
64304
64312
|
}
|
|
64305
64313
|
}
|
|
64306
64314
|
setHover() {
|
|
64307
|
-
|
|
64315
|
+
let hover = this.board.items.getUnderPointer(0)[0];
|
|
64316
|
+
if (hover instanceof BaseItem && hover.index) {
|
|
64317
|
+
const group = hover;
|
|
64318
|
+
const inverse = group.getWorldMatrix().getInverse();
|
|
64319
|
+
const pointer = this.board.pointer.point;
|
|
64320
|
+
const localPointer = pointer.copy();
|
|
64321
|
+
localPointer.transform(inverse);
|
|
64322
|
+
for (const child of group.index.listAll()) {
|
|
64323
|
+
if (child.getMbr().isUnderPoint(localPointer)) {
|
|
64324
|
+
hover = child;
|
|
64325
|
+
break;
|
|
64326
|
+
}
|
|
64327
|
+
}
|
|
64328
|
+
}
|
|
64308
64329
|
if (hover) {
|
|
64309
64330
|
if (hover !== this.hover.item) {
|
|
64310
64331
|
this.hover = {
|
|
@@ -64361,8 +64382,18 @@ class ConnectorSnap {
|
|
|
64361
64382
|
return nearest;
|
|
64362
64383
|
}
|
|
64363
64384
|
getClosestPointOnItem(item, position4) {
|
|
64364
|
-
|
|
64365
|
-
|
|
64385
|
+
let worldEdgePoint;
|
|
64386
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
64387
|
+
const parentMatrix = item.getParentWorldMatrix();
|
|
64388
|
+
const localPos = position4.copy();
|
|
64389
|
+
localPos.transform(parentMatrix.getInverse());
|
|
64390
|
+
const localEdge = item.getNearestEdgePointTo(localPos);
|
|
64391
|
+
worldEdgePoint = localEdge.copy();
|
|
64392
|
+
parentMatrix.apply(worldEdgePoint);
|
|
64393
|
+
} else {
|
|
64394
|
+
worldEdgePoint = item.getNearestEdgePointTo(position4);
|
|
64395
|
+
}
|
|
64396
|
+
return getFixedPoint(item, worldEdgePoint);
|
|
64366
64397
|
}
|
|
64367
64398
|
isNearBorder(item) {
|
|
64368
64399
|
if (!item) {
|
|
@@ -64391,10 +64422,15 @@ class ConnectorSnap {
|
|
|
64391
64422
|
}
|
|
64392
64423
|
}
|
|
64393
64424
|
setAnchors(item) {
|
|
64394
|
-
const
|
|
64395
|
-
if (!
|
|
64425
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
64426
|
+
if (!localPoints) {
|
|
64396
64427
|
return;
|
|
64397
64428
|
}
|
|
64429
|
+
const points = item instanceof BaseItem && item.parent !== "Board" ? localPoints.map((p3) => {
|
|
64430
|
+
const wp = p3.copy();
|
|
64431
|
+
item.getParentWorldMatrix().apply(wp);
|
|
64432
|
+
return wp;
|
|
64433
|
+
}) : localPoints;
|
|
64398
64434
|
const anchors = [];
|
|
64399
64435
|
for (const { x, y } of points) {
|
|
64400
64436
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -64428,9 +64464,19 @@ class ConnectorSnap {
|
|
|
64428
64464
|
const { item, anchor } = this.snap;
|
|
64429
64465
|
if (item) {
|
|
64430
64466
|
if (!anchor) {
|
|
64431
|
-
|
|
64432
|
-
if (
|
|
64433
|
-
|
|
64467
|
+
let edgePoint;
|
|
64468
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
64469
|
+
const parentMatrix = item.getParentWorldMatrix();
|
|
64470
|
+
const localPointer = pointer.copy();
|
|
64471
|
+
localPointer.transform(parentMatrix.getInverse());
|
|
64472
|
+
const localEdge = item.getNearestEdgePointTo(localPointer);
|
|
64473
|
+
edgePoint = localEdge.copy();
|
|
64474
|
+
parentMatrix.apply(edgePoint);
|
|
64475
|
+
} else {
|
|
64476
|
+
edgePoint = item.getNearestEdgePointTo(pointer);
|
|
64477
|
+
}
|
|
64478
|
+
if (edgePoint.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
|
|
64479
|
+
this.snap.point = new Anchor(edgePoint.x, edgePoint.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
|
|
64434
64480
|
} else {
|
|
64435
64481
|
this.snap.point = null;
|
|
64436
64482
|
}
|
|
@@ -64459,6 +64505,7 @@ class ConnectorSnap {
|
|
|
64459
64505
|
}
|
|
64460
64506
|
var init_ConnectorSnap = __esm(() => {
|
|
64461
64507
|
init_ControlPoint();
|
|
64508
|
+
init_BaseItem2();
|
|
64462
64509
|
init_Anchor2();
|
|
64463
64510
|
init_Connector();
|
|
64464
64511
|
});
|
package/dist/cjs/index.js
CHANGED
|
@@ -58392,14 +58392,19 @@ var init_Connector = __esm(() => {
|
|
|
58392
58392
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
58393
58393
|
return false;
|
|
58394
58394
|
const item = start.item;
|
|
58395
|
-
const
|
|
58396
|
-
if (!
|
|
58395
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
58396
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
58397
58397
|
return false;
|
|
58398
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
58399
|
+
const p3 = a2.copy();
|
|
58400
|
+
item.getParentWorldMatrix().apply(p3);
|
|
58401
|
+
return p3;
|
|
58402
|
+
}) : localAnchors;
|
|
58398
58403
|
const EPS = 2;
|
|
58399
58404
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
58400
58405
|
if (!isOnAnchor)
|
|
58401
58406
|
return false;
|
|
58402
|
-
const center = item.getMbr().getCenter();
|
|
58407
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
58403
58408
|
const dx = this.endPoint.x - center.x;
|
|
58404
58409
|
const dy = this.endPoint.y - center.y;
|
|
58405
58410
|
if (dx === 0 && dy === 0)
|
|
@@ -58430,14 +58435,19 @@ var init_Connector = __esm(() => {
|
|
|
58430
58435
|
if (end.pointType !== "Fixed" && end.pointType !== "Floating")
|
|
58431
58436
|
return false;
|
|
58432
58437
|
const item = end.item;
|
|
58433
|
-
const
|
|
58434
|
-
if (!
|
|
58438
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
58439
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
58435
58440
|
return false;
|
|
58441
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
58442
|
+
const p3 = a2.copy();
|
|
58443
|
+
item.getParentWorldMatrix().apply(p3);
|
|
58444
|
+
return p3;
|
|
58445
|
+
}) : localAnchors;
|
|
58436
58446
|
const EPS = 2;
|
|
58437
58447
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - end.x) < EPS && Math.abs(a2.y - end.y) < EPS);
|
|
58438
58448
|
if (!isOnAnchor)
|
|
58439
58449
|
return false;
|
|
58440
|
-
const center = item.getMbr().getCenter();
|
|
58450
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
58441
58451
|
const dx = this.startPoint.x - center.x;
|
|
58442
58452
|
const dy = this.startPoint.y - center.y;
|
|
58443
58453
|
if (dx === 0 && dy === 0)
|
|
@@ -63713,6 +63723,9 @@ var init_Group = __esm(() => {
|
|
|
63713
63723
|
case "Transformation":
|
|
63714
63724
|
super.apply(op);
|
|
63715
63725
|
this.updateMbr();
|
|
63726
|
+
for (const child of this.index.listAll()) {
|
|
63727
|
+
child.subject.publish(child);
|
|
63728
|
+
}
|
|
63716
63729
|
break;
|
|
63717
63730
|
case "Group":
|
|
63718
63731
|
if (op.method === "addChild") {
|
|
@@ -64293,18 +64306,26 @@ class ConnectorSnap {
|
|
|
64293
64306
|
} else if (anchor) {
|
|
64294
64307
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
64295
64308
|
} else if (point5) {
|
|
64296
|
-
|
|
64297
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
64309
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
64298
64310
|
} else {
|
|
64299
|
-
|
|
64300
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64301
|
-
} else {
|
|
64302
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64303
|
-
}
|
|
64311
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
64304
64312
|
}
|
|
64305
64313
|
}
|
|
64306
64314
|
setHover() {
|
|
64307
|
-
|
|
64315
|
+
let hover = this.board.items.getUnderPointer(0)[0];
|
|
64316
|
+
if (hover instanceof BaseItem && hover.index) {
|
|
64317
|
+
const group = hover;
|
|
64318
|
+
const inverse = group.getWorldMatrix().getInverse();
|
|
64319
|
+
const pointer = this.board.pointer.point;
|
|
64320
|
+
const localPointer = pointer.copy();
|
|
64321
|
+
localPointer.transform(inverse);
|
|
64322
|
+
for (const child of group.index.listAll()) {
|
|
64323
|
+
if (child.getMbr().isUnderPoint(localPointer)) {
|
|
64324
|
+
hover = child;
|
|
64325
|
+
break;
|
|
64326
|
+
}
|
|
64327
|
+
}
|
|
64328
|
+
}
|
|
64308
64329
|
if (hover) {
|
|
64309
64330
|
if (hover !== this.hover.item) {
|
|
64310
64331
|
this.hover = {
|
|
@@ -64361,8 +64382,18 @@ class ConnectorSnap {
|
|
|
64361
64382
|
return nearest;
|
|
64362
64383
|
}
|
|
64363
64384
|
getClosestPointOnItem(item, position4) {
|
|
64364
|
-
|
|
64365
|
-
|
|
64385
|
+
let worldEdgePoint;
|
|
64386
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
64387
|
+
const parentMatrix = item.getParentWorldMatrix();
|
|
64388
|
+
const localPos = position4.copy();
|
|
64389
|
+
localPos.transform(parentMatrix.getInverse());
|
|
64390
|
+
const localEdge = item.getNearestEdgePointTo(localPos);
|
|
64391
|
+
worldEdgePoint = localEdge.copy();
|
|
64392
|
+
parentMatrix.apply(worldEdgePoint);
|
|
64393
|
+
} else {
|
|
64394
|
+
worldEdgePoint = item.getNearestEdgePointTo(position4);
|
|
64395
|
+
}
|
|
64396
|
+
return getFixedPoint(item, worldEdgePoint);
|
|
64366
64397
|
}
|
|
64367
64398
|
isNearBorder(item) {
|
|
64368
64399
|
if (!item) {
|
|
@@ -64391,10 +64422,15 @@ class ConnectorSnap {
|
|
|
64391
64422
|
}
|
|
64392
64423
|
}
|
|
64393
64424
|
setAnchors(item) {
|
|
64394
|
-
const
|
|
64395
|
-
if (!
|
|
64425
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
64426
|
+
if (!localPoints) {
|
|
64396
64427
|
return;
|
|
64397
64428
|
}
|
|
64429
|
+
const points = item instanceof BaseItem && item.parent !== "Board" ? localPoints.map((p3) => {
|
|
64430
|
+
const wp = p3.copy();
|
|
64431
|
+
item.getParentWorldMatrix().apply(wp);
|
|
64432
|
+
return wp;
|
|
64433
|
+
}) : localPoints;
|
|
64398
64434
|
const anchors = [];
|
|
64399
64435
|
for (const { x, y } of points) {
|
|
64400
64436
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -64428,9 +64464,19 @@ class ConnectorSnap {
|
|
|
64428
64464
|
const { item, anchor } = this.snap;
|
|
64429
64465
|
if (item) {
|
|
64430
64466
|
if (!anchor) {
|
|
64431
|
-
|
|
64432
|
-
if (
|
|
64433
|
-
|
|
64467
|
+
let edgePoint;
|
|
64468
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
64469
|
+
const parentMatrix = item.getParentWorldMatrix();
|
|
64470
|
+
const localPointer = pointer.copy();
|
|
64471
|
+
localPointer.transform(parentMatrix.getInverse());
|
|
64472
|
+
const localEdge = item.getNearestEdgePointTo(localPointer);
|
|
64473
|
+
edgePoint = localEdge.copy();
|
|
64474
|
+
parentMatrix.apply(edgePoint);
|
|
64475
|
+
} else {
|
|
64476
|
+
edgePoint = item.getNearestEdgePointTo(pointer);
|
|
64477
|
+
}
|
|
64478
|
+
if (edgePoint.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
|
|
64479
|
+
this.snap.point = new Anchor(edgePoint.x, edgePoint.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
|
|
64434
64480
|
} else {
|
|
64435
64481
|
this.snap.point = null;
|
|
64436
64482
|
}
|
|
@@ -64459,6 +64505,7 @@ class ConnectorSnap {
|
|
|
64459
64505
|
}
|
|
64460
64506
|
var init_ConnectorSnap = __esm(() => {
|
|
64461
64507
|
init_ControlPoint();
|
|
64508
|
+
init_BaseItem2();
|
|
64462
64509
|
init_Anchor2();
|
|
64463
64510
|
init_Connector();
|
|
64464
64511
|
});
|
package/dist/cjs/node.js
CHANGED
|
@@ -60812,14 +60812,19 @@ var init_Connector = __esm(() => {
|
|
|
60812
60812
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
60813
60813
|
return false;
|
|
60814
60814
|
const item = start.item;
|
|
60815
|
-
const
|
|
60816
|
-
if (!
|
|
60815
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
60816
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
60817
60817
|
return false;
|
|
60818
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
60819
|
+
const p3 = a2.copy();
|
|
60820
|
+
item.getParentWorldMatrix().apply(p3);
|
|
60821
|
+
return p3;
|
|
60822
|
+
}) : localAnchors;
|
|
60818
60823
|
const EPS = 2;
|
|
60819
60824
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
60820
60825
|
if (!isOnAnchor)
|
|
60821
60826
|
return false;
|
|
60822
|
-
const center = item.getMbr().getCenter();
|
|
60827
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
60823
60828
|
const dx = this.endPoint.x - center.x;
|
|
60824
60829
|
const dy = this.endPoint.y - center.y;
|
|
60825
60830
|
if (dx === 0 && dy === 0)
|
|
@@ -60850,14 +60855,19 @@ var init_Connector = __esm(() => {
|
|
|
60850
60855
|
if (end.pointType !== "Fixed" && end.pointType !== "Floating")
|
|
60851
60856
|
return false;
|
|
60852
60857
|
const item = end.item;
|
|
60853
|
-
const
|
|
60854
|
-
if (!
|
|
60858
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
60859
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
60855
60860
|
return false;
|
|
60861
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
60862
|
+
const p3 = a2.copy();
|
|
60863
|
+
item.getParentWorldMatrix().apply(p3);
|
|
60864
|
+
return p3;
|
|
60865
|
+
}) : localAnchors;
|
|
60856
60866
|
const EPS = 2;
|
|
60857
60867
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - end.x) < EPS && Math.abs(a2.y - end.y) < EPS);
|
|
60858
60868
|
if (!isOnAnchor)
|
|
60859
60869
|
return false;
|
|
60860
|
-
const center = item.getMbr().getCenter();
|
|
60870
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
60861
60871
|
const dx = this.startPoint.x - center.x;
|
|
60862
60872
|
const dy = this.startPoint.y - center.y;
|
|
60863
60873
|
if (dx === 0 && dy === 0)
|
|
@@ -66133,6 +66143,9 @@ var init_Group = __esm(() => {
|
|
|
66133
66143
|
case "Transformation":
|
|
66134
66144
|
super.apply(op);
|
|
66135
66145
|
this.updateMbr();
|
|
66146
|
+
for (const child of this.index.listAll()) {
|
|
66147
|
+
child.subject.publish(child);
|
|
66148
|
+
}
|
|
66136
66149
|
break;
|
|
66137
66150
|
case "Group":
|
|
66138
66151
|
if (op.method === "addChild") {
|
|
@@ -66713,18 +66726,26 @@ class ConnectorSnap {
|
|
|
66713
66726
|
} else if (anchor) {
|
|
66714
66727
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
66715
66728
|
} else if (point5) {
|
|
66716
|
-
|
|
66717
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
66729
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
66718
66730
|
} else {
|
|
66719
|
-
|
|
66720
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
66721
|
-
} else {
|
|
66722
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
66723
|
-
}
|
|
66731
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
66724
66732
|
}
|
|
66725
66733
|
}
|
|
66726
66734
|
setHover() {
|
|
66727
|
-
|
|
66735
|
+
let hover = this.board.items.getUnderPointer(0)[0];
|
|
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
|
+
}
|
|
66728
66749
|
if (hover) {
|
|
66729
66750
|
if (hover !== this.hover.item) {
|
|
66730
66751
|
this.hover = {
|
|
@@ -66781,8 +66802,18 @@ class ConnectorSnap {
|
|
|
66781
66802
|
return nearest;
|
|
66782
66803
|
}
|
|
66783
66804
|
getClosestPointOnItem(item, position4) {
|
|
66784
|
-
|
|
66785
|
-
|
|
66805
|
+
let worldEdgePoint;
|
|
66806
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
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);
|
|
66786
66817
|
}
|
|
66787
66818
|
isNearBorder(item) {
|
|
66788
66819
|
if (!item) {
|
|
@@ -66811,10 +66842,15 @@ class ConnectorSnap {
|
|
|
66811
66842
|
}
|
|
66812
66843
|
}
|
|
66813
66844
|
setAnchors(item) {
|
|
66814
|
-
const
|
|
66815
|
-
if (!
|
|
66845
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
66846
|
+
if (!localPoints) {
|
|
66816
66847
|
return;
|
|
66817
66848
|
}
|
|
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;
|
|
66818
66854
|
const anchors = [];
|
|
66819
66855
|
for (const { x, y } of points) {
|
|
66820
66856
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -66848,9 +66884,19 @@ class ConnectorSnap {
|
|
|
66848
66884
|
const { item, anchor } = this.snap;
|
|
66849
66885
|
if (item) {
|
|
66850
66886
|
if (!anchor) {
|
|
66851
|
-
|
|
66852
|
-
if (
|
|
66853
|
-
|
|
66887
|
+
let edgePoint;
|
|
66888
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
66889
|
+
const parentMatrix = item.getParentWorldMatrix();
|
|
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);
|
|
66854
66900
|
} else {
|
|
66855
66901
|
this.snap.point = null;
|
|
66856
66902
|
}
|
|
@@ -66879,6 +66925,7 @@ class ConnectorSnap {
|
|
|
66879
66925
|
}
|
|
66880
66926
|
var init_ConnectorSnap = __esm(() => {
|
|
66881
66927
|
init_ControlPoint();
|
|
66928
|
+
init_BaseItem2();
|
|
66882
66929
|
init_Anchor2();
|
|
66883
66930
|
init_Connector();
|
|
66884
66931
|
});
|
package/dist/esm/browser.js
CHANGED
|
@@ -58329,14 +58329,19 @@ var init_Connector = __esm(() => {
|
|
|
58329
58329
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
58330
58330
|
return false;
|
|
58331
58331
|
const item = start.item;
|
|
58332
|
-
const
|
|
58333
|
-
if (!
|
|
58332
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
58333
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
58334
58334
|
return false;
|
|
58335
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
58336
|
+
const p3 = a2.copy();
|
|
58337
|
+
item.getParentWorldMatrix().apply(p3);
|
|
58338
|
+
return p3;
|
|
58339
|
+
}) : localAnchors;
|
|
58335
58340
|
const EPS = 2;
|
|
58336
58341
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
58337
58342
|
if (!isOnAnchor)
|
|
58338
58343
|
return false;
|
|
58339
|
-
const center = item.getMbr().getCenter();
|
|
58344
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
58340
58345
|
const dx = this.endPoint.x - center.x;
|
|
58341
58346
|
const dy = this.endPoint.y - center.y;
|
|
58342
58347
|
if (dx === 0 && dy === 0)
|
|
@@ -58367,14 +58372,19 @@ var init_Connector = __esm(() => {
|
|
|
58367
58372
|
if (end.pointType !== "Fixed" && end.pointType !== "Floating")
|
|
58368
58373
|
return false;
|
|
58369
58374
|
const item = end.item;
|
|
58370
|
-
const
|
|
58371
|
-
if (!
|
|
58375
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
58376
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
58372
58377
|
return false;
|
|
58378
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
58379
|
+
const p3 = a2.copy();
|
|
58380
|
+
item.getParentWorldMatrix().apply(p3);
|
|
58381
|
+
return p3;
|
|
58382
|
+
}) : localAnchors;
|
|
58373
58383
|
const EPS = 2;
|
|
58374
58384
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - end.x) < EPS && Math.abs(a2.y - end.y) < EPS);
|
|
58375
58385
|
if (!isOnAnchor)
|
|
58376
58386
|
return false;
|
|
58377
|
-
const center = item.getMbr().getCenter();
|
|
58387
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
58378
58388
|
const dx = this.startPoint.x - center.x;
|
|
58379
58389
|
const dy = this.startPoint.y - center.y;
|
|
58380
58390
|
if (dx === 0 && dy === 0)
|
|
@@ -63650,6 +63660,9 @@ var init_Group = __esm(() => {
|
|
|
63650
63660
|
case "Transformation":
|
|
63651
63661
|
super.apply(op);
|
|
63652
63662
|
this.updateMbr();
|
|
63663
|
+
for (const child of this.index.listAll()) {
|
|
63664
|
+
child.subject.publish(child);
|
|
63665
|
+
}
|
|
63653
63666
|
break;
|
|
63654
63667
|
case "Group":
|
|
63655
63668
|
if (op.method === "addChild") {
|
|
@@ -64230,18 +64243,26 @@ class ConnectorSnap {
|
|
|
64230
64243
|
} else if (anchor) {
|
|
64231
64244
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
64232
64245
|
} else if (point5) {
|
|
64233
|
-
|
|
64234
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
64246
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
64235
64247
|
} else {
|
|
64236
|
-
|
|
64237
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64238
|
-
} else {
|
|
64239
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64240
|
-
}
|
|
64248
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
64241
64249
|
}
|
|
64242
64250
|
}
|
|
64243
64251
|
setHover() {
|
|
64244
|
-
|
|
64252
|
+
let hover = this.board.items.getUnderPointer(0)[0];
|
|
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
|
+
}
|
|
64245
64266
|
if (hover) {
|
|
64246
64267
|
if (hover !== this.hover.item) {
|
|
64247
64268
|
this.hover = {
|
|
@@ -64298,8 +64319,18 @@ class ConnectorSnap {
|
|
|
64298
64319
|
return nearest;
|
|
64299
64320
|
}
|
|
64300
64321
|
getClosestPointOnItem(item, position4) {
|
|
64301
|
-
|
|
64302
|
-
|
|
64322
|
+
let worldEdgePoint;
|
|
64323
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
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);
|
|
64303
64334
|
}
|
|
64304
64335
|
isNearBorder(item) {
|
|
64305
64336
|
if (!item) {
|
|
@@ -64328,10 +64359,15 @@ class ConnectorSnap {
|
|
|
64328
64359
|
}
|
|
64329
64360
|
}
|
|
64330
64361
|
setAnchors(item) {
|
|
64331
|
-
const
|
|
64332
|
-
if (!
|
|
64362
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
64363
|
+
if (!localPoints) {
|
|
64333
64364
|
return;
|
|
64334
64365
|
}
|
|
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;
|
|
64335
64371
|
const anchors = [];
|
|
64336
64372
|
for (const { x, y } of points) {
|
|
64337
64373
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -64365,9 +64401,19 @@ class ConnectorSnap {
|
|
|
64365
64401
|
const { item, anchor } = this.snap;
|
|
64366
64402
|
if (item) {
|
|
64367
64403
|
if (!anchor) {
|
|
64368
|
-
|
|
64369
|
-
if (
|
|
64370
|
-
|
|
64404
|
+
let edgePoint;
|
|
64405
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
64406
|
+
const parentMatrix = item.getParentWorldMatrix();
|
|
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);
|
|
64371
64417
|
} else {
|
|
64372
64418
|
this.snap.point = null;
|
|
64373
64419
|
}
|
|
@@ -64396,6 +64442,7 @@ class ConnectorSnap {
|
|
|
64396
64442
|
}
|
|
64397
64443
|
var init_ConnectorSnap = __esm(() => {
|
|
64398
64444
|
init_ControlPoint();
|
|
64445
|
+
init_BaseItem2();
|
|
64399
64446
|
init_Anchor2();
|
|
64400
64447
|
init_Connector();
|
|
64401
64448
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -58322,14 +58322,19 @@ var init_Connector = __esm(() => {
|
|
|
58322
58322
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
58323
58323
|
return false;
|
|
58324
58324
|
const item = start.item;
|
|
58325
|
-
const
|
|
58326
|
-
if (!
|
|
58325
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
58326
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
58327
58327
|
return false;
|
|
58328
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
58329
|
+
const p3 = a2.copy();
|
|
58330
|
+
item.getParentWorldMatrix().apply(p3);
|
|
58331
|
+
return p3;
|
|
58332
|
+
}) : localAnchors;
|
|
58328
58333
|
const EPS = 2;
|
|
58329
58334
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
58330
58335
|
if (!isOnAnchor)
|
|
58331
58336
|
return false;
|
|
58332
|
-
const center = item.getMbr().getCenter();
|
|
58337
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
58333
58338
|
const dx = this.endPoint.x - center.x;
|
|
58334
58339
|
const dy = this.endPoint.y - center.y;
|
|
58335
58340
|
if (dx === 0 && dy === 0)
|
|
@@ -58360,14 +58365,19 @@ var init_Connector = __esm(() => {
|
|
|
58360
58365
|
if (end.pointType !== "Fixed" && end.pointType !== "Floating")
|
|
58361
58366
|
return false;
|
|
58362
58367
|
const item = end.item;
|
|
58363
|
-
const
|
|
58364
|
-
if (!
|
|
58368
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
58369
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
58365
58370
|
return false;
|
|
58371
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
58372
|
+
const p3 = a2.copy();
|
|
58373
|
+
item.getParentWorldMatrix().apply(p3);
|
|
58374
|
+
return p3;
|
|
58375
|
+
}) : localAnchors;
|
|
58366
58376
|
const EPS = 2;
|
|
58367
58377
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - end.x) < EPS && Math.abs(a2.y - end.y) < EPS);
|
|
58368
58378
|
if (!isOnAnchor)
|
|
58369
58379
|
return false;
|
|
58370
|
-
const center = item.getMbr().getCenter();
|
|
58380
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
58371
58381
|
const dx = this.startPoint.x - center.x;
|
|
58372
58382
|
const dy = this.startPoint.y - center.y;
|
|
58373
58383
|
if (dx === 0 && dy === 0)
|
|
@@ -63643,6 +63653,9 @@ var init_Group = __esm(() => {
|
|
|
63643
63653
|
case "Transformation":
|
|
63644
63654
|
super.apply(op);
|
|
63645
63655
|
this.updateMbr();
|
|
63656
|
+
for (const child of this.index.listAll()) {
|
|
63657
|
+
child.subject.publish(child);
|
|
63658
|
+
}
|
|
63646
63659
|
break;
|
|
63647
63660
|
case "Group":
|
|
63648
63661
|
if (op.method === "addChild") {
|
|
@@ -64223,18 +64236,26 @@ class ConnectorSnap {
|
|
|
64223
64236
|
} else if (anchor) {
|
|
64224
64237
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
64225
64238
|
} else if (point5) {
|
|
64226
|
-
|
|
64227
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
64239
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
64228
64240
|
} else {
|
|
64229
|
-
|
|
64230
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64231
|
-
} else {
|
|
64232
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64233
|
-
}
|
|
64241
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
64234
64242
|
}
|
|
64235
64243
|
}
|
|
64236
64244
|
setHover() {
|
|
64237
|
-
|
|
64245
|
+
let hover = this.board.items.getUnderPointer(0)[0];
|
|
64246
|
+
if (hover instanceof BaseItem && hover.index) {
|
|
64247
|
+
const group = hover;
|
|
64248
|
+
const inverse = group.getWorldMatrix().getInverse();
|
|
64249
|
+
const pointer = this.board.pointer.point;
|
|
64250
|
+
const localPointer = pointer.copy();
|
|
64251
|
+
localPointer.transform(inverse);
|
|
64252
|
+
for (const child of group.index.listAll()) {
|
|
64253
|
+
if (child.getMbr().isUnderPoint(localPointer)) {
|
|
64254
|
+
hover = child;
|
|
64255
|
+
break;
|
|
64256
|
+
}
|
|
64257
|
+
}
|
|
64258
|
+
}
|
|
64238
64259
|
if (hover) {
|
|
64239
64260
|
if (hover !== this.hover.item) {
|
|
64240
64261
|
this.hover = {
|
|
@@ -64291,8 +64312,18 @@ class ConnectorSnap {
|
|
|
64291
64312
|
return nearest;
|
|
64292
64313
|
}
|
|
64293
64314
|
getClosestPointOnItem(item, position4) {
|
|
64294
|
-
|
|
64295
|
-
|
|
64315
|
+
let worldEdgePoint;
|
|
64316
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
64317
|
+
const parentMatrix = item.getParentWorldMatrix();
|
|
64318
|
+
const localPos = position4.copy();
|
|
64319
|
+
localPos.transform(parentMatrix.getInverse());
|
|
64320
|
+
const localEdge = item.getNearestEdgePointTo(localPos);
|
|
64321
|
+
worldEdgePoint = localEdge.copy();
|
|
64322
|
+
parentMatrix.apply(worldEdgePoint);
|
|
64323
|
+
} else {
|
|
64324
|
+
worldEdgePoint = item.getNearestEdgePointTo(position4);
|
|
64325
|
+
}
|
|
64326
|
+
return getFixedPoint(item, worldEdgePoint);
|
|
64296
64327
|
}
|
|
64297
64328
|
isNearBorder(item) {
|
|
64298
64329
|
if (!item) {
|
|
@@ -64321,10 +64352,15 @@ class ConnectorSnap {
|
|
|
64321
64352
|
}
|
|
64322
64353
|
}
|
|
64323
64354
|
setAnchors(item) {
|
|
64324
|
-
const
|
|
64325
|
-
if (!
|
|
64355
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
64356
|
+
if (!localPoints) {
|
|
64326
64357
|
return;
|
|
64327
64358
|
}
|
|
64359
|
+
const points = item instanceof BaseItem && item.parent !== "Board" ? localPoints.map((p3) => {
|
|
64360
|
+
const wp = p3.copy();
|
|
64361
|
+
item.getParentWorldMatrix().apply(wp);
|
|
64362
|
+
return wp;
|
|
64363
|
+
}) : localPoints;
|
|
64328
64364
|
const anchors = [];
|
|
64329
64365
|
for (const { x, y } of points) {
|
|
64330
64366
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -64358,9 +64394,19 @@ class ConnectorSnap {
|
|
|
64358
64394
|
const { item, anchor } = this.snap;
|
|
64359
64395
|
if (item) {
|
|
64360
64396
|
if (!anchor) {
|
|
64361
|
-
|
|
64362
|
-
if (
|
|
64363
|
-
|
|
64397
|
+
let edgePoint;
|
|
64398
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
64399
|
+
const parentMatrix = item.getParentWorldMatrix();
|
|
64400
|
+
const localPointer = pointer.copy();
|
|
64401
|
+
localPointer.transform(parentMatrix.getInverse());
|
|
64402
|
+
const localEdge = item.getNearestEdgePointTo(localPointer);
|
|
64403
|
+
edgePoint = localEdge.copy();
|
|
64404
|
+
parentMatrix.apply(edgePoint);
|
|
64405
|
+
} else {
|
|
64406
|
+
edgePoint = item.getNearestEdgePointTo(pointer);
|
|
64407
|
+
}
|
|
64408
|
+
if (edgePoint.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
|
|
64409
|
+
this.snap.point = new Anchor(edgePoint.x, edgePoint.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
|
|
64364
64410
|
} else {
|
|
64365
64411
|
this.snap.point = null;
|
|
64366
64412
|
}
|
|
@@ -64389,6 +64435,7 @@ class ConnectorSnap {
|
|
|
64389
64435
|
}
|
|
64390
64436
|
var init_ConnectorSnap = __esm(() => {
|
|
64391
64437
|
init_ControlPoint();
|
|
64438
|
+
init_BaseItem2();
|
|
64392
64439
|
init_Anchor2();
|
|
64393
64440
|
init_Connector();
|
|
64394
64441
|
});
|
package/dist/esm/node.js
CHANGED
|
@@ -60731,14 +60731,19 @@ var init_Connector = __esm(() => {
|
|
|
60731
60731
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
60732
60732
|
return false;
|
|
60733
60733
|
const item = start.item;
|
|
60734
|
-
const
|
|
60735
|
-
if (!
|
|
60734
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
60735
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
60736
60736
|
return false;
|
|
60737
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
60738
|
+
const p3 = a2.copy();
|
|
60739
|
+
item.getParentWorldMatrix().apply(p3);
|
|
60740
|
+
return p3;
|
|
60741
|
+
}) : localAnchors;
|
|
60737
60742
|
const EPS = 2;
|
|
60738
60743
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
60739
60744
|
if (!isOnAnchor)
|
|
60740
60745
|
return false;
|
|
60741
|
-
const center = item.getMbr().getCenter();
|
|
60746
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
60742
60747
|
const dx = this.endPoint.x - center.x;
|
|
60743
60748
|
const dy = this.endPoint.y - center.y;
|
|
60744
60749
|
if (dx === 0 && dy === 0)
|
|
@@ -60769,14 +60774,19 @@ var init_Connector = __esm(() => {
|
|
|
60769
60774
|
if (end.pointType !== "Fixed" && end.pointType !== "Floating")
|
|
60770
60775
|
return false;
|
|
60771
60776
|
const item = end.item;
|
|
60772
|
-
const
|
|
60773
|
-
if (!
|
|
60777
|
+
const localAnchors = item.getSnapAnchorPoints?.();
|
|
60778
|
+
if (!localAnchors || localAnchors.length === 0)
|
|
60774
60779
|
return false;
|
|
60780
|
+
const anchors = item instanceof BaseItem && item.parent !== "Board" ? localAnchors.map((a2) => {
|
|
60781
|
+
const p3 = a2.copy();
|
|
60782
|
+
item.getParentWorldMatrix().apply(p3);
|
|
60783
|
+
return p3;
|
|
60784
|
+
}) : localAnchors;
|
|
60775
60785
|
const EPS = 2;
|
|
60776
60786
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - end.x) < EPS && Math.abs(a2.y - end.y) < EPS);
|
|
60777
60787
|
if (!isOnAnchor)
|
|
60778
60788
|
return false;
|
|
60779
|
-
const center = item.getMbr().getCenter();
|
|
60789
|
+
const center = item instanceof BaseItem && item.parent !== "Board" ? item.getWorldMbr().getCenter() : item.getMbr().getCenter();
|
|
60780
60790
|
const dx = this.startPoint.x - center.x;
|
|
60781
60791
|
const dy = this.startPoint.y - center.y;
|
|
60782
60792
|
if (dx === 0 && dy === 0)
|
|
@@ -66052,6 +66062,9 @@ var init_Group = __esm(() => {
|
|
|
66052
66062
|
case "Transformation":
|
|
66053
66063
|
super.apply(op);
|
|
66054
66064
|
this.updateMbr();
|
|
66065
|
+
for (const child of this.index.listAll()) {
|
|
66066
|
+
child.subject.publish(child);
|
|
66067
|
+
}
|
|
66055
66068
|
break;
|
|
66056
66069
|
case "Group":
|
|
66057
66070
|
if (op.method === "addChild") {
|
|
@@ -66632,18 +66645,26 @@ class ConnectorSnap {
|
|
|
66632
66645
|
} else if (anchor) {
|
|
66633
66646
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
66634
66647
|
} else if (point5) {
|
|
66635
|
-
|
|
66636
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
66648
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
66637
66649
|
} else {
|
|
66638
|
-
|
|
66639
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
66640
|
-
} else {
|
|
66641
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
66642
|
-
}
|
|
66650
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
66643
66651
|
}
|
|
66644
66652
|
}
|
|
66645
66653
|
setHover() {
|
|
66646
|
-
|
|
66654
|
+
let hover = this.board.items.getUnderPointer(0)[0];
|
|
66655
|
+
if (hover instanceof BaseItem && hover.index) {
|
|
66656
|
+
const group = hover;
|
|
66657
|
+
const inverse = group.getWorldMatrix().getInverse();
|
|
66658
|
+
const pointer = this.board.pointer.point;
|
|
66659
|
+
const localPointer = pointer.copy();
|
|
66660
|
+
localPointer.transform(inverse);
|
|
66661
|
+
for (const child of group.index.listAll()) {
|
|
66662
|
+
if (child.getMbr().isUnderPoint(localPointer)) {
|
|
66663
|
+
hover = child;
|
|
66664
|
+
break;
|
|
66665
|
+
}
|
|
66666
|
+
}
|
|
66667
|
+
}
|
|
66647
66668
|
if (hover) {
|
|
66648
66669
|
if (hover !== this.hover.item) {
|
|
66649
66670
|
this.hover = {
|
|
@@ -66700,8 +66721,18 @@ class ConnectorSnap {
|
|
|
66700
66721
|
return nearest;
|
|
66701
66722
|
}
|
|
66702
66723
|
getClosestPointOnItem(item, position4) {
|
|
66703
|
-
|
|
66704
|
-
|
|
66724
|
+
let worldEdgePoint;
|
|
66725
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
66726
|
+
const parentMatrix = item.getParentWorldMatrix();
|
|
66727
|
+
const localPos = position4.copy();
|
|
66728
|
+
localPos.transform(parentMatrix.getInverse());
|
|
66729
|
+
const localEdge = item.getNearestEdgePointTo(localPos);
|
|
66730
|
+
worldEdgePoint = localEdge.copy();
|
|
66731
|
+
parentMatrix.apply(worldEdgePoint);
|
|
66732
|
+
} else {
|
|
66733
|
+
worldEdgePoint = item.getNearestEdgePointTo(position4);
|
|
66734
|
+
}
|
|
66735
|
+
return getFixedPoint(item, worldEdgePoint);
|
|
66705
66736
|
}
|
|
66706
66737
|
isNearBorder(item) {
|
|
66707
66738
|
if (!item) {
|
|
@@ -66730,10 +66761,15 @@ class ConnectorSnap {
|
|
|
66730
66761
|
}
|
|
66731
66762
|
}
|
|
66732
66763
|
setAnchors(item) {
|
|
66733
|
-
const
|
|
66734
|
-
if (!
|
|
66764
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
66765
|
+
if (!localPoints) {
|
|
66735
66766
|
return;
|
|
66736
66767
|
}
|
|
66768
|
+
const points = item instanceof BaseItem && item.parent !== "Board" ? localPoints.map((p3) => {
|
|
66769
|
+
const wp = p3.copy();
|
|
66770
|
+
item.getParentWorldMatrix().apply(wp);
|
|
66771
|
+
return wp;
|
|
66772
|
+
}) : localPoints;
|
|
66737
66773
|
const anchors = [];
|
|
66738
66774
|
for (const { x, y } of points) {
|
|
66739
66775
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -66767,9 +66803,19 @@ class ConnectorSnap {
|
|
|
66767
66803
|
const { item, anchor } = this.snap;
|
|
66768
66804
|
if (item) {
|
|
66769
66805
|
if (!anchor) {
|
|
66770
|
-
|
|
66771
|
-
if (
|
|
66772
|
-
|
|
66806
|
+
let edgePoint;
|
|
66807
|
+
if (item instanceof BaseItem && item.parent !== "Board") {
|
|
66808
|
+
const parentMatrix = item.getParentWorldMatrix();
|
|
66809
|
+
const localPointer = pointer.copy();
|
|
66810
|
+
localPointer.transform(parentMatrix.getInverse());
|
|
66811
|
+
const localEdge = item.getNearestEdgePointTo(localPointer);
|
|
66812
|
+
edgePoint = localEdge.copy();
|
|
66813
|
+
parentMatrix.apply(edgePoint);
|
|
66814
|
+
} else {
|
|
66815
|
+
edgePoint = item.getNearestEdgePointTo(pointer);
|
|
66816
|
+
}
|
|
66817
|
+
if (edgePoint.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
|
|
66818
|
+
this.snap.point = new Anchor(edgePoint.x, edgePoint.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
|
|
66773
66819
|
} else {
|
|
66774
66820
|
this.snap.point = null;
|
|
66775
66821
|
}
|
|
@@ -66798,6 +66844,7 @@ class ConnectorSnap {
|
|
|
66798
66844
|
}
|
|
66799
66845
|
var init_ConnectorSnap = __esm(() => {
|
|
66800
66846
|
init_ControlPoint();
|
|
66847
|
+
init_BaseItem2();
|
|
66801
66848
|
init_Anchor2();
|
|
66802
66849
|
init_Connector();
|
|
66803
66850
|
});
|