microboard-temp 0.14.1 → 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 +73 -21
- package/dist/cjs/index.js +73 -21
- package/dist/cjs/node.js +73 -21
- package/dist/esm/browser.js +73 -21
- package/dist/esm/index.js +73 -21
- package/dist/esm/node.js +73 -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)
|
|
@@ -63577,6 +63587,11 @@ var init_Drawing = __esm(() => {
|
|
|
63577
63587
|
}
|
|
63578
63588
|
this.updateMbr();
|
|
63579
63589
|
break;
|
|
63590
|
+
case "Transformation":
|
|
63591
|
+
super.apply(op);
|
|
63592
|
+
this.updateMbr();
|
|
63593
|
+
this.updateLines();
|
|
63594
|
+
break;
|
|
63580
63595
|
default:
|
|
63581
63596
|
super.apply(op);
|
|
63582
63597
|
return;
|
|
@@ -63708,6 +63723,9 @@ var init_Group = __esm(() => {
|
|
|
63708
63723
|
case "Transformation":
|
|
63709
63724
|
super.apply(op);
|
|
63710
63725
|
this.updateMbr();
|
|
63726
|
+
for (const child of this.index.listAll()) {
|
|
63727
|
+
child.subject.publish(child);
|
|
63728
|
+
}
|
|
63711
63729
|
break;
|
|
63712
63730
|
case "Group":
|
|
63713
63731
|
if (op.method === "addChild") {
|
|
@@ -64288,18 +64306,26 @@ class ConnectorSnap {
|
|
|
64288
64306
|
} else if (anchor) {
|
|
64289
64307
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
64290
64308
|
} else if (point5) {
|
|
64291
|
-
|
|
64292
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
64309
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
64293
64310
|
} else {
|
|
64294
|
-
|
|
64295
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64296
|
-
} else {
|
|
64297
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64298
|
-
}
|
|
64311
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
64299
64312
|
}
|
|
64300
64313
|
}
|
|
64301
64314
|
setHover() {
|
|
64302
|
-
|
|
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
|
+
}
|
|
64303
64329
|
if (hover) {
|
|
64304
64330
|
if (hover !== this.hover.item) {
|
|
64305
64331
|
this.hover = {
|
|
@@ -64356,8 +64382,18 @@ class ConnectorSnap {
|
|
|
64356
64382
|
return nearest;
|
|
64357
64383
|
}
|
|
64358
64384
|
getClosestPointOnItem(item, position4) {
|
|
64359
|
-
|
|
64360
|
-
|
|
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);
|
|
64361
64397
|
}
|
|
64362
64398
|
isNearBorder(item) {
|
|
64363
64399
|
if (!item) {
|
|
@@ -64386,10 +64422,15 @@ class ConnectorSnap {
|
|
|
64386
64422
|
}
|
|
64387
64423
|
}
|
|
64388
64424
|
setAnchors(item) {
|
|
64389
|
-
const
|
|
64390
|
-
if (!
|
|
64425
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
64426
|
+
if (!localPoints) {
|
|
64391
64427
|
return;
|
|
64392
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;
|
|
64393
64434
|
const anchors = [];
|
|
64394
64435
|
for (const { x, y } of points) {
|
|
64395
64436
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -64423,9 +64464,19 @@ class ConnectorSnap {
|
|
|
64423
64464
|
const { item, anchor } = this.snap;
|
|
64424
64465
|
if (item) {
|
|
64425
64466
|
if (!anchor) {
|
|
64426
|
-
|
|
64427
|
-
if (
|
|
64428
|
-
|
|
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);
|
|
64429
64480
|
} else {
|
|
64430
64481
|
this.snap.point = null;
|
|
64431
64482
|
}
|
|
@@ -64454,6 +64505,7 @@ class ConnectorSnap {
|
|
|
64454
64505
|
}
|
|
64455
64506
|
var init_ConnectorSnap = __esm(() => {
|
|
64456
64507
|
init_ControlPoint();
|
|
64508
|
+
init_BaseItem2();
|
|
64457
64509
|
init_Anchor2();
|
|
64458
64510
|
init_Connector();
|
|
64459
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)
|
|
@@ -63577,6 +63587,11 @@ var init_Drawing = __esm(() => {
|
|
|
63577
63587
|
}
|
|
63578
63588
|
this.updateMbr();
|
|
63579
63589
|
break;
|
|
63590
|
+
case "Transformation":
|
|
63591
|
+
super.apply(op);
|
|
63592
|
+
this.updateMbr();
|
|
63593
|
+
this.updateLines();
|
|
63594
|
+
break;
|
|
63580
63595
|
default:
|
|
63581
63596
|
super.apply(op);
|
|
63582
63597
|
return;
|
|
@@ -63708,6 +63723,9 @@ var init_Group = __esm(() => {
|
|
|
63708
63723
|
case "Transformation":
|
|
63709
63724
|
super.apply(op);
|
|
63710
63725
|
this.updateMbr();
|
|
63726
|
+
for (const child of this.index.listAll()) {
|
|
63727
|
+
child.subject.publish(child);
|
|
63728
|
+
}
|
|
63711
63729
|
break;
|
|
63712
63730
|
case "Group":
|
|
63713
63731
|
if (op.method === "addChild") {
|
|
@@ -64288,18 +64306,26 @@ class ConnectorSnap {
|
|
|
64288
64306
|
} else if (anchor) {
|
|
64289
64307
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
64290
64308
|
} else if (point5) {
|
|
64291
|
-
|
|
64292
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
64309
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
64293
64310
|
} else {
|
|
64294
|
-
|
|
64295
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64296
|
-
} else {
|
|
64297
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64298
|
-
}
|
|
64311
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
64299
64312
|
}
|
|
64300
64313
|
}
|
|
64301
64314
|
setHover() {
|
|
64302
|
-
|
|
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
|
+
}
|
|
64303
64329
|
if (hover) {
|
|
64304
64330
|
if (hover !== this.hover.item) {
|
|
64305
64331
|
this.hover = {
|
|
@@ -64356,8 +64382,18 @@ class ConnectorSnap {
|
|
|
64356
64382
|
return nearest;
|
|
64357
64383
|
}
|
|
64358
64384
|
getClosestPointOnItem(item, position4) {
|
|
64359
|
-
|
|
64360
|
-
|
|
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);
|
|
64361
64397
|
}
|
|
64362
64398
|
isNearBorder(item) {
|
|
64363
64399
|
if (!item) {
|
|
@@ -64386,10 +64422,15 @@ class ConnectorSnap {
|
|
|
64386
64422
|
}
|
|
64387
64423
|
}
|
|
64388
64424
|
setAnchors(item) {
|
|
64389
|
-
const
|
|
64390
|
-
if (!
|
|
64425
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
64426
|
+
if (!localPoints) {
|
|
64391
64427
|
return;
|
|
64392
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;
|
|
64393
64434
|
const anchors = [];
|
|
64394
64435
|
for (const { x, y } of points) {
|
|
64395
64436
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -64423,9 +64464,19 @@ class ConnectorSnap {
|
|
|
64423
64464
|
const { item, anchor } = this.snap;
|
|
64424
64465
|
if (item) {
|
|
64425
64466
|
if (!anchor) {
|
|
64426
|
-
|
|
64427
|
-
if (
|
|
64428
|
-
|
|
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);
|
|
64429
64480
|
} else {
|
|
64430
64481
|
this.snap.point = null;
|
|
64431
64482
|
}
|
|
@@ -64454,6 +64505,7 @@ class ConnectorSnap {
|
|
|
64454
64505
|
}
|
|
64455
64506
|
var init_ConnectorSnap = __esm(() => {
|
|
64456
64507
|
init_ControlPoint();
|
|
64508
|
+
init_BaseItem2();
|
|
64457
64509
|
init_Anchor2();
|
|
64458
64510
|
init_Connector();
|
|
64459
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)
|
|
@@ -65997,6 +66007,11 @@ var init_Drawing = __esm(() => {
|
|
|
65997
66007
|
}
|
|
65998
66008
|
this.updateMbr();
|
|
65999
66009
|
break;
|
|
66010
|
+
case "Transformation":
|
|
66011
|
+
super.apply(op);
|
|
66012
|
+
this.updateMbr();
|
|
66013
|
+
this.updateLines();
|
|
66014
|
+
break;
|
|
66000
66015
|
default:
|
|
66001
66016
|
super.apply(op);
|
|
66002
66017
|
return;
|
|
@@ -66128,6 +66143,9 @@ var init_Group = __esm(() => {
|
|
|
66128
66143
|
case "Transformation":
|
|
66129
66144
|
super.apply(op);
|
|
66130
66145
|
this.updateMbr();
|
|
66146
|
+
for (const child of this.index.listAll()) {
|
|
66147
|
+
child.subject.publish(child);
|
|
66148
|
+
}
|
|
66131
66149
|
break;
|
|
66132
66150
|
case "Group":
|
|
66133
66151
|
if (op.method === "addChild") {
|
|
@@ -66708,18 +66726,26 @@ class ConnectorSnap {
|
|
|
66708
66726
|
} else if (anchor) {
|
|
66709
66727
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
66710
66728
|
} else if (point5) {
|
|
66711
|
-
|
|
66712
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
66729
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
66713
66730
|
} else {
|
|
66714
|
-
|
|
66715
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
66716
|
-
} else {
|
|
66717
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
66718
|
-
}
|
|
66731
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
66719
66732
|
}
|
|
66720
66733
|
}
|
|
66721
66734
|
setHover() {
|
|
66722
|
-
|
|
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
|
+
}
|
|
66723
66749
|
if (hover) {
|
|
66724
66750
|
if (hover !== this.hover.item) {
|
|
66725
66751
|
this.hover = {
|
|
@@ -66776,8 +66802,18 @@ class ConnectorSnap {
|
|
|
66776
66802
|
return nearest;
|
|
66777
66803
|
}
|
|
66778
66804
|
getClosestPointOnItem(item, position4) {
|
|
66779
|
-
|
|
66780
|
-
|
|
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);
|
|
66781
66817
|
}
|
|
66782
66818
|
isNearBorder(item) {
|
|
66783
66819
|
if (!item) {
|
|
@@ -66806,10 +66842,15 @@ class ConnectorSnap {
|
|
|
66806
66842
|
}
|
|
66807
66843
|
}
|
|
66808
66844
|
setAnchors(item) {
|
|
66809
|
-
const
|
|
66810
|
-
if (!
|
|
66845
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
66846
|
+
if (!localPoints) {
|
|
66811
66847
|
return;
|
|
66812
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;
|
|
66813
66854
|
const anchors = [];
|
|
66814
66855
|
for (const { x, y } of points) {
|
|
66815
66856
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -66843,9 +66884,19 @@ class ConnectorSnap {
|
|
|
66843
66884
|
const { item, anchor } = this.snap;
|
|
66844
66885
|
if (item) {
|
|
66845
66886
|
if (!anchor) {
|
|
66846
|
-
|
|
66847
|
-
if (
|
|
66848
|
-
|
|
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);
|
|
66849
66900
|
} else {
|
|
66850
66901
|
this.snap.point = null;
|
|
66851
66902
|
}
|
|
@@ -66874,6 +66925,7 @@ class ConnectorSnap {
|
|
|
66874
66925
|
}
|
|
66875
66926
|
var init_ConnectorSnap = __esm(() => {
|
|
66876
66927
|
init_ControlPoint();
|
|
66928
|
+
init_BaseItem2();
|
|
66877
66929
|
init_Anchor2();
|
|
66878
66930
|
init_Connector();
|
|
66879
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)
|
|
@@ -63514,6 +63524,11 @@ var init_Drawing = __esm(() => {
|
|
|
63514
63524
|
}
|
|
63515
63525
|
this.updateMbr();
|
|
63516
63526
|
break;
|
|
63527
|
+
case "Transformation":
|
|
63528
|
+
super.apply(op);
|
|
63529
|
+
this.updateMbr();
|
|
63530
|
+
this.updateLines();
|
|
63531
|
+
break;
|
|
63517
63532
|
default:
|
|
63518
63533
|
super.apply(op);
|
|
63519
63534
|
return;
|
|
@@ -63645,6 +63660,9 @@ var init_Group = __esm(() => {
|
|
|
63645
63660
|
case "Transformation":
|
|
63646
63661
|
super.apply(op);
|
|
63647
63662
|
this.updateMbr();
|
|
63663
|
+
for (const child of this.index.listAll()) {
|
|
63664
|
+
child.subject.publish(child);
|
|
63665
|
+
}
|
|
63648
63666
|
break;
|
|
63649
63667
|
case "Group":
|
|
63650
63668
|
if (op.method === "addChild") {
|
|
@@ -64225,18 +64243,26 @@ class ConnectorSnap {
|
|
|
64225
64243
|
} else if (anchor) {
|
|
64226
64244
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
64227
64245
|
} else if (point5) {
|
|
64228
|
-
|
|
64229
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
64246
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
64230
64247
|
} else {
|
|
64231
|
-
|
|
64232
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64233
|
-
} else {
|
|
64234
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64235
|
-
}
|
|
64248
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
64236
64249
|
}
|
|
64237
64250
|
}
|
|
64238
64251
|
setHover() {
|
|
64239
|
-
|
|
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
|
+
}
|
|
64240
64266
|
if (hover) {
|
|
64241
64267
|
if (hover !== this.hover.item) {
|
|
64242
64268
|
this.hover = {
|
|
@@ -64293,8 +64319,18 @@ class ConnectorSnap {
|
|
|
64293
64319
|
return nearest;
|
|
64294
64320
|
}
|
|
64295
64321
|
getClosestPointOnItem(item, position4) {
|
|
64296
|
-
|
|
64297
|
-
|
|
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);
|
|
64298
64334
|
}
|
|
64299
64335
|
isNearBorder(item) {
|
|
64300
64336
|
if (!item) {
|
|
@@ -64323,10 +64359,15 @@ class ConnectorSnap {
|
|
|
64323
64359
|
}
|
|
64324
64360
|
}
|
|
64325
64361
|
setAnchors(item) {
|
|
64326
|
-
const
|
|
64327
|
-
if (!
|
|
64362
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
64363
|
+
if (!localPoints) {
|
|
64328
64364
|
return;
|
|
64329
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;
|
|
64330
64371
|
const anchors = [];
|
|
64331
64372
|
for (const { x, y } of points) {
|
|
64332
64373
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -64360,9 +64401,19 @@ class ConnectorSnap {
|
|
|
64360
64401
|
const { item, anchor } = this.snap;
|
|
64361
64402
|
if (item) {
|
|
64362
64403
|
if (!anchor) {
|
|
64363
|
-
|
|
64364
|
-
if (
|
|
64365
|
-
|
|
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);
|
|
64366
64417
|
} else {
|
|
64367
64418
|
this.snap.point = null;
|
|
64368
64419
|
}
|
|
@@ -64391,6 +64442,7 @@ class ConnectorSnap {
|
|
|
64391
64442
|
}
|
|
64392
64443
|
var init_ConnectorSnap = __esm(() => {
|
|
64393
64444
|
init_ControlPoint();
|
|
64445
|
+
init_BaseItem2();
|
|
64394
64446
|
init_Anchor2();
|
|
64395
64447
|
init_Connector();
|
|
64396
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)
|
|
@@ -63507,6 +63517,11 @@ var init_Drawing = __esm(() => {
|
|
|
63507
63517
|
}
|
|
63508
63518
|
this.updateMbr();
|
|
63509
63519
|
break;
|
|
63520
|
+
case "Transformation":
|
|
63521
|
+
super.apply(op);
|
|
63522
|
+
this.updateMbr();
|
|
63523
|
+
this.updateLines();
|
|
63524
|
+
break;
|
|
63510
63525
|
default:
|
|
63511
63526
|
super.apply(op);
|
|
63512
63527
|
return;
|
|
@@ -63638,6 +63653,9 @@ var init_Group = __esm(() => {
|
|
|
63638
63653
|
case "Transformation":
|
|
63639
63654
|
super.apply(op);
|
|
63640
63655
|
this.updateMbr();
|
|
63656
|
+
for (const child of this.index.listAll()) {
|
|
63657
|
+
child.subject.publish(child);
|
|
63658
|
+
}
|
|
63641
63659
|
break;
|
|
63642
63660
|
case "Group":
|
|
63643
63661
|
if (op.method === "addChild") {
|
|
@@ -64218,18 +64236,26 @@ class ConnectorSnap {
|
|
|
64218
64236
|
} else if (anchor) {
|
|
64219
64237
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
64220
64238
|
} else if (point5) {
|
|
64221
|
-
|
|
64222
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
64239
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
64223
64240
|
} else {
|
|
64224
|
-
|
|
64225
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64226
|
-
} else {
|
|
64227
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
64228
|
-
}
|
|
64241
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
64229
64242
|
}
|
|
64230
64243
|
}
|
|
64231
64244
|
setHover() {
|
|
64232
|
-
|
|
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
|
+
}
|
|
64233
64259
|
if (hover) {
|
|
64234
64260
|
if (hover !== this.hover.item) {
|
|
64235
64261
|
this.hover = {
|
|
@@ -64286,8 +64312,18 @@ class ConnectorSnap {
|
|
|
64286
64312
|
return nearest;
|
|
64287
64313
|
}
|
|
64288
64314
|
getClosestPointOnItem(item, position4) {
|
|
64289
|
-
|
|
64290
|
-
|
|
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);
|
|
64291
64327
|
}
|
|
64292
64328
|
isNearBorder(item) {
|
|
64293
64329
|
if (!item) {
|
|
@@ -64316,10 +64352,15 @@ class ConnectorSnap {
|
|
|
64316
64352
|
}
|
|
64317
64353
|
}
|
|
64318
64354
|
setAnchors(item) {
|
|
64319
|
-
const
|
|
64320
|
-
if (!
|
|
64355
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
64356
|
+
if (!localPoints) {
|
|
64321
64357
|
return;
|
|
64322
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;
|
|
64323
64364
|
const anchors = [];
|
|
64324
64365
|
for (const { x, y } of points) {
|
|
64325
64366
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -64353,9 +64394,19 @@ class ConnectorSnap {
|
|
|
64353
64394
|
const { item, anchor } = this.snap;
|
|
64354
64395
|
if (item) {
|
|
64355
64396
|
if (!anchor) {
|
|
64356
|
-
|
|
64357
|
-
if (
|
|
64358
|
-
|
|
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);
|
|
64359
64410
|
} else {
|
|
64360
64411
|
this.snap.point = null;
|
|
64361
64412
|
}
|
|
@@ -64384,6 +64435,7 @@ class ConnectorSnap {
|
|
|
64384
64435
|
}
|
|
64385
64436
|
var init_ConnectorSnap = __esm(() => {
|
|
64386
64437
|
init_ControlPoint();
|
|
64438
|
+
init_BaseItem2();
|
|
64387
64439
|
init_Anchor2();
|
|
64388
64440
|
init_Connector();
|
|
64389
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)
|
|
@@ -65916,6 +65926,11 @@ var init_Drawing = __esm(() => {
|
|
|
65916
65926
|
}
|
|
65917
65927
|
this.updateMbr();
|
|
65918
65928
|
break;
|
|
65929
|
+
case "Transformation":
|
|
65930
|
+
super.apply(op);
|
|
65931
|
+
this.updateMbr();
|
|
65932
|
+
this.updateLines();
|
|
65933
|
+
break;
|
|
65919
65934
|
default:
|
|
65920
65935
|
super.apply(op);
|
|
65921
65936
|
return;
|
|
@@ -66047,6 +66062,9 @@ var init_Group = __esm(() => {
|
|
|
66047
66062
|
case "Transformation":
|
|
66048
66063
|
super.apply(op);
|
|
66049
66064
|
this.updateMbr();
|
|
66065
|
+
for (const child of this.index.listAll()) {
|
|
66066
|
+
child.subject.publish(child);
|
|
66067
|
+
}
|
|
66050
66068
|
break;
|
|
66051
66069
|
case "Group":
|
|
66052
66070
|
if (op.method === "addChild") {
|
|
@@ -66627,18 +66645,26 @@ class ConnectorSnap {
|
|
|
66627
66645
|
} else if (anchor) {
|
|
66628
66646
|
this.controlPoint = getFixedPoint(item, anchor.getCenter());
|
|
66629
66647
|
} else if (point5) {
|
|
66630
|
-
|
|
66631
|
-
this.controlPoint = getFixedPoint(item, nearest2);
|
|
66648
|
+
this.controlPoint = getFixedPoint(item, point5.getCenter());
|
|
66632
66649
|
} else {
|
|
66633
|
-
|
|
66634
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
66635
|
-
} else {
|
|
66636
|
-
this.controlPoint = getFixedPoint(item, pointer);
|
|
66637
|
-
}
|
|
66650
|
+
this.controlPoint = getFixedPoint(item, pointer);
|
|
66638
66651
|
}
|
|
66639
66652
|
}
|
|
66640
66653
|
setHover() {
|
|
66641
|
-
|
|
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
|
+
}
|
|
66642
66668
|
if (hover) {
|
|
66643
66669
|
if (hover !== this.hover.item) {
|
|
66644
66670
|
this.hover = {
|
|
@@ -66695,8 +66721,18 @@ class ConnectorSnap {
|
|
|
66695
66721
|
return nearest;
|
|
66696
66722
|
}
|
|
66697
66723
|
getClosestPointOnItem(item, position4) {
|
|
66698
|
-
|
|
66699
|
-
|
|
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);
|
|
66700
66736
|
}
|
|
66701
66737
|
isNearBorder(item) {
|
|
66702
66738
|
if (!item) {
|
|
@@ -66725,10 +66761,15 @@ class ConnectorSnap {
|
|
|
66725
66761
|
}
|
|
66726
66762
|
}
|
|
66727
66763
|
setAnchors(item) {
|
|
66728
|
-
const
|
|
66729
|
-
if (!
|
|
66764
|
+
const localPoints = item.getSnapAnchorPoints();
|
|
66765
|
+
if (!localPoints) {
|
|
66730
66766
|
return;
|
|
66731
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;
|
|
66732
66773
|
const anchors = [];
|
|
66733
66774
|
for (const { x, y } of points) {
|
|
66734
66775
|
anchors.push(new Anchor(x, y, 5, this.color.anchorBorder, this.color.anchorBackground, 1));
|
|
@@ -66762,9 +66803,19 @@ class ConnectorSnap {
|
|
|
66762
66803
|
const { item, anchor } = this.snap;
|
|
66763
66804
|
if (item) {
|
|
66764
66805
|
if (!anchor) {
|
|
66765
|
-
|
|
66766
|
-
if (
|
|
66767
|
-
|
|
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);
|
|
66768
66819
|
} else {
|
|
66769
66820
|
this.snap.point = null;
|
|
66770
66821
|
}
|
|
@@ -66793,6 +66844,7 @@ class ConnectorSnap {
|
|
|
66793
66844
|
}
|
|
66794
66845
|
var init_ConnectorSnap = __esm(() => {
|
|
66795
66846
|
init_ControlPoint();
|
|
66847
|
+
init_BaseItem2();
|
|
66796
66848
|
init_Anchor2();
|
|
66797
66849
|
init_Connector();
|
|
66798
66850
|
});
|