microboard-temp 0.13.29 → 0.13.31
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 +16 -19
- package/dist/cjs/index.js +16 -19
- package/dist/cjs/node.js +16 -19
- package/dist/esm/browser.js +16 -19
- package/dist/esm/index.js +16 -19
- package/dist/esm/node.js +16 -19
- package/dist/types/Items/Connector/Connector.d.ts +2 -1
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -22466,7 +22466,7 @@ class RichText extends BaseItem {
|
|
|
22466
22466
|
return this.editor.maxWidth || this.container.getWidth();
|
|
22467
22467
|
}
|
|
22468
22468
|
if (this.isContainerSet) {
|
|
22469
|
-
return this.
|
|
22469
|
+
return this.getTransformedContainer().getWidth();
|
|
22470
22470
|
} else {
|
|
22471
22471
|
return this.containerMaxWidth || this.editor.maxWidth;
|
|
22472
22472
|
}
|
|
@@ -37812,37 +37812,39 @@ class Connector2 extends BaseItem {
|
|
|
37812
37812
|
const point5 = this.startPoint;
|
|
37813
37813
|
if (point5.pointType !== "Board") {
|
|
37814
37814
|
point5.recalculatePoint();
|
|
37815
|
-
this.smartJumpStartEdge()
|
|
37816
|
-
|
|
37817
|
-
|
|
37815
|
+
if (!this.smartJumpStartEdge()) {
|
|
37816
|
+
this.updatePaths();
|
|
37817
|
+
this.subject.publish(this);
|
|
37818
|
+
}
|
|
37818
37819
|
}
|
|
37819
37820
|
};
|
|
37820
37821
|
observerEndPointItem = () => {
|
|
37821
37822
|
const point5 = this.endPoint;
|
|
37822
37823
|
if (point5.pointType !== "Board") {
|
|
37823
37824
|
point5.recalculatePoint();
|
|
37824
|
-
this.smartJumpStartEdge()
|
|
37825
|
-
|
|
37826
|
-
|
|
37825
|
+
if (!this.smartJumpStartEdge()) {
|
|
37826
|
+
this.updatePaths();
|
|
37827
|
+
this.subject.publish(this);
|
|
37828
|
+
}
|
|
37827
37829
|
}
|
|
37828
37830
|
};
|
|
37829
37831
|
smartJumpStartEdge() {
|
|
37830
37832
|
const start = this.startPoint;
|
|
37831
37833
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
37832
|
-
return;
|
|
37834
|
+
return false;
|
|
37833
37835
|
const item = start.item;
|
|
37834
37836
|
const anchors = item.getSnapAnchorPoints?.();
|
|
37835
37837
|
if (!anchors || anchors.length === 0)
|
|
37836
|
-
return;
|
|
37838
|
+
return false;
|
|
37837
37839
|
const EPS = 2;
|
|
37838
37840
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
37839
37841
|
if (!isOnAnchor)
|
|
37840
|
-
return;
|
|
37842
|
+
return false;
|
|
37841
37843
|
const center = item.getMbr().getCenter();
|
|
37842
37844
|
const dx = this.endPoint.x - center.x;
|
|
37843
37845
|
const dy = this.endPoint.y - center.y;
|
|
37844
37846
|
if (dx === 0 && dy === 0)
|
|
37845
|
-
return;
|
|
37847
|
+
return false;
|
|
37846
37848
|
let best = anchors[0];
|
|
37847
37849
|
let bestDot = -Infinity;
|
|
37848
37850
|
for (const anchor of anchors) {
|
|
@@ -37858,8 +37860,9 @@ class Connector2 extends BaseItem {
|
|
|
37858
37860
|
}
|
|
37859
37861
|
}
|
|
37860
37862
|
if (Math.abs(best.x - start.x) < EPS && Math.abs(best.y - start.y) < EPS)
|
|
37861
|
-
return;
|
|
37862
|
-
this.
|
|
37863
|
+
return false;
|
|
37864
|
+
this.setStartPoint(new FixedPoint(item, toRelativePoint(best, item)));
|
|
37865
|
+
return true;
|
|
37863
37866
|
}
|
|
37864
37867
|
clearObservedItems() {
|
|
37865
37868
|
const startPoint = this.getStartPoint();
|
|
@@ -40478,16 +40481,10 @@ class Shape extends BaseItem {
|
|
|
40478
40481
|
div.setAttribute("stroke-width", this.borderWidth.toString());
|
|
40479
40482
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40480
40483
|
textElement.id = `${this.getId()}_text`;
|
|
40481
|
-
textElement.style.maxWidth = `${width}px`;
|
|
40482
40484
|
textElement.style.overflow = "auto";
|
|
40483
40485
|
positionRelatively(textElement, div);
|
|
40484
40486
|
resetElementScale(textElement);
|
|
40485
40487
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40486
|
-
const [dx, dy] = [
|
|
40487
|
-
(width - parseInt(textElement.style.width)) / scaleX / 2 - 1,
|
|
40488
|
-
(height - parseInt(textElement.style.height)) / scaleY / 2 - 1
|
|
40489
|
-
];
|
|
40490
|
-
translateElementBy(textElement, dx, dy);
|
|
40491
40488
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
40492
40489
|
if (this.getLinkTo()) {
|
|
40493
40490
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
package/dist/cjs/index.js
CHANGED
|
@@ -22466,7 +22466,7 @@ class RichText extends BaseItem {
|
|
|
22466
22466
|
return this.editor.maxWidth || this.container.getWidth();
|
|
22467
22467
|
}
|
|
22468
22468
|
if (this.isContainerSet) {
|
|
22469
|
-
return this.
|
|
22469
|
+
return this.getTransformedContainer().getWidth();
|
|
22470
22470
|
} else {
|
|
22471
22471
|
return this.containerMaxWidth || this.editor.maxWidth;
|
|
22472
22472
|
}
|
|
@@ -37812,37 +37812,39 @@ class Connector2 extends BaseItem {
|
|
|
37812
37812
|
const point5 = this.startPoint;
|
|
37813
37813
|
if (point5.pointType !== "Board") {
|
|
37814
37814
|
point5.recalculatePoint();
|
|
37815
|
-
this.smartJumpStartEdge()
|
|
37816
|
-
|
|
37817
|
-
|
|
37815
|
+
if (!this.smartJumpStartEdge()) {
|
|
37816
|
+
this.updatePaths();
|
|
37817
|
+
this.subject.publish(this);
|
|
37818
|
+
}
|
|
37818
37819
|
}
|
|
37819
37820
|
};
|
|
37820
37821
|
observerEndPointItem = () => {
|
|
37821
37822
|
const point5 = this.endPoint;
|
|
37822
37823
|
if (point5.pointType !== "Board") {
|
|
37823
37824
|
point5.recalculatePoint();
|
|
37824
|
-
this.smartJumpStartEdge()
|
|
37825
|
-
|
|
37826
|
-
|
|
37825
|
+
if (!this.smartJumpStartEdge()) {
|
|
37826
|
+
this.updatePaths();
|
|
37827
|
+
this.subject.publish(this);
|
|
37828
|
+
}
|
|
37827
37829
|
}
|
|
37828
37830
|
};
|
|
37829
37831
|
smartJumpStartEdge() {
|
|
37830
37832
|
const start = this.startPoint;
|
|
37831
37833
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
37832
|
-
return;
|
|
37834
|
+
return false;
|
|
37833
37835
|
const item = start.item;
|
|
37834
37836
|
const anchors = item.getSnapAnchorPoints?.();
|
|
37835
37837
|
if (!anchors || anchors.length === 0)
|
|
37836
|
-
return;
|
|
37838
|
+
return false;
|
|
37837
37839
|
const EPS = 2;
|
|
37838
37840
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
37839
37841
|
if (!isOnAnchor)
|
|
37840
|
-
return;
|
|
37842
|
+
return false;
|
|
37841
37843
|
const center = item.getMbr().getCenter();
|
|
37842
37844
|
const dx = this.endPoint.x - center.x;
|
|
37843
37845
|
const dy = this.endPoint.y - center.y;
|
|
37844
37846
|
if (dx === 0 && dy === 0)
|
|
37845
|
-
return;
|
|
37847
|
+
return false;
|
|
37846
37848
|
let best = anchors[0];
|
|
37847
37849
|
let bestDot = -Infinity;
|
|
37848
37850
|
for (const anchor of anchors) {
|
|
@@ -37858,8 +37860,9 @@ class Connector2 extends BaseItem {
|
|
|
37858
37860
|
}
|
|
37859
37861
|
}
|
|
37860
37862
|
if (Math.abs(best.x - start.x) < EPS && Math.abs(best.y - start.y) < EPS)
|
|
37861
|
-
return;
|
|
37862
|
-
this.
|
|
37863
|
+
return false;
|
|
37864
|
+
this.setStartPoint(new FixedPoint(item, toRelativePoint(best, item)));
|
|
37865
|
+
return true;
|
|
37863
37866
|
}
|
|
37864
37867
|
clearObservedItems() {
|
|
37865
37868
|
const startPoint = this.getStartPoint();
|
|
@@ -40478,16 +40481,10 @@ class Shape extends BaseItem {
|
|
|
40478
40481
|
div.setAttribute("stroke-width", this.borderWidth.toString());
|
|
40479
40482
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40480
40483
|
textElement.id = `${this.getId()}_text`;
|
|
40481
|
-
textElement.style.maxWidth = `${width}px`;
|
|
40482
40484
|
textElement.style.overflow = "auto";
|
|
40483
40485
|
positionRelatively(textElement, div);
|
|
40484
40486
|
resetElementScale(textElement);
|
|
40485
40487
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40486
|
-
const [dx, dy] = [
|
|
40487
|
-
(width - parseInt(textElement.style.width)) / scaleX / 2 - 1,
|
|
40488
|
-
(height - parseInt(textElement.style.height)) / scaleY / 2 - 1
|
|
40489
|
-
];
|
|
40490
|
-
translateElementBy(textElement, dx, dy);
|
|
40491
40488
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
40492
40489
|
if (this.getLinkTo()) {
|
|
40493
40490
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
package/dist/cjs/node.js
CHANGED
|
@@ -24938,7 +24938,7 @@ class RichText extends BaseItem {
|
|
|
24938
24938
|
return this.editor.maxWidth || this.container.getWidth();
|
|
24939
24939
|
}
|
|
24940
24940
|
if (this.isContainerSet) {
|
|
24941
|
-
return this.
|
|
24941
|
+
return this.getTransformedContainer().getWidth();
|
|
24942
24942
|
} else {
|
|
24943
24943
|
return this.containerMaxWidth || this.editor.maxWidth;
|
|
24944
24944
|
}
|
|
@@ -40285,37 +40285,39 @@ class Connector2 extends BaseItem {
|
|
|
40285
40285
|
const point5 = this.startPoint;
|
|
40286
40286
|
if (point5.pointType !== "Board") {
|
|
40287
40287
|
point5.recalculatePoint();
|
|
40288
|
-
this.smartJumpStartEdge()
|
|
40289
|
-
|
|
40290
|
-
|
|
40288
|
+
if (!this.smartJumpStartEdge()) {
|
|
40289
|
+
this.updatePaths();
|
|
40290
|
+
this.subject.publish(this);
|
|
40291
|
+
}
|
|
40291
40292
|
}
|
|
40292
40293
|
};
|
|
40293
40294
|
observerEndPointItem = () => {
|
|
40294
40295
|
const point5 = this.endPoint;
|
|
40295
40296
|
if (point5.pointType !== "Board") {
|
|
40296
40297
|
point5.recalculatePoint();
|
|
40297
|
-
this.smartJumpStartEdge()
|
|
40298
|
-
|
|
40299
|
-
|
|
40298
|
+
if (!this.smartJumpStartEdge()) {
|
|
40299
|
+
this.updatePaths();
|
|
40300
|
+
this.subject.publish(this);
|
|
40301
|
+
}
|
|
40300
40302
|
}
|
|
40301
40303
|
};
|
|
40302
40304
|
smartJumpStartEdge() {
|
|
40303
40305
|
const start = this.startPoint;
|
|
40304
40306
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
40305
|
-
return;
|
|
40307
|
+
return false;
|
|
40306
40308
|
const item = start.item;
|
|
40307
40309
|
const anchors = item.getSnapAnchorPoints?.();
|
|
40308
40310
|
if (!anchors || anchors.length === 0)
|
|
40309
|
-
return;
|
|
40311
|
+
return false;
|
|
40310
40312
|
const EPS = 2;
|
|
40311
40313
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
40312
40314
|
if (!isOnAnchor)
|
|
40313
|
-
return;
|
|
40315
|
+
return false;
|
|
40314
40316
|
const center = item.getMbr().getCenter();
|
|
40315
40317
|
const dx = this.endPoint.x - center.x;
|
|
40316
40318
|
const dy = this.endPoint.y - center.y;
|
|
40317
40319
|
if (dx === 0 && dy === 0)
|
|
40318
|
-
return;
|
|
40320
|
+
return false;
|
|
40319
40321
|
let best = anchors[0];
|
|
40320
40322
|
let bestDot = -Infinity;
|
|
40321
40323
|
for (const anchor of anchors) {
|
|
@@ -40331,8 +40333,9 @@ class Connector2 extends BaseItem {
|
|
|
40331
40333
|
}
|
|
40332
40334
|
}
|
|
40333
40335
|
if (Math.abs(best.x - start.x) < EPS && Math.abs(best.y - start.y) < EPS)
|
|
40334
|
-
return;
|
|
40335
|
-
this.
|
|
40336
|
+
return false;
|
|
40337
|
+
this.setStartPoint(new FixedPoint(item, toRelativePoint(best, item)));
|
|
40338
|
+
return true;
|
|
40336
40339
|
}
|
|
40337
40340
|
clearObservedItems() {
|
|
40338
40341
|
const startPoint = this.getStartPoint();
|
|
@@ -42951,16 +42954,10 @@ class Shape extends BaseItem {
|
|
|
42951
42954
|
div.setAttribute("stroke-width", this.borderWidth.toString());
|
|
42952
42955
|
const textElement = this.text.renderHTML(documentFactory);
|
|
42953
42956
|
textElement.id = `${this.getId()}_text`;
|
|
42954
|
-
textElement.style.maxWidth = `${width}px`;
|
|
42955
42957
|
textElement.style.overflow = "auto";
|
|
42956
42958
|
positionRelatively(textElement, div);
|
|
42957
42959
|
resetElementScale(textElement);
|
|
42958
42960
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
42959
|
-
const [dx, dy] = [
|
|
42960
|
-
(width - parseInt(textElement.style.width)) / scaleX / 2 - 1,
|
|
42961
|
-
(height - parseInt(textElement.style.height)) / scaleY / 2 - 1
|
|
42962
|
-
];
|
|
42963
|
-
translateElementBy(textElement, dx, dy);
|
|
42964
42961
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
42965
42962
|
if (this.getLinkTo()) {
|
|
42966
42963
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
package/dist/esm/browser.js
CHANGED
|
@@ -22295,7 +22295,7 @@ class RichText extends BaseItem {
|
|
|
22295
22295
|
return this.editor.maxWidth || this.container.getWidth();
|
|
22296
22296
|
}
|
|
22297
22297
|
if (this.isContainerSet) {
|
|
22298
|
-
return this.
|
|
22298
|
+
return this.getTransformedContainer().getWidth();
|
|
22299
22299
|
} else {
|
|
22300
22300
|
return this.containerMaxWidth || this.editor.maxWidth;
|
|
22301
22301
|
}
|
|
@@ -37641,37 +37641,39 @@ class Connector2 extends BaseItem {
|
|
|
37641
37641
|
const point5 = this.startPoint;
|
|
37642
37642
|
if (point5.pointType !== "Board") {
|
|
37643
37643
|
point5.recalculatePoint();
|
|
37644
|
-
this.smartJumpStartEdge()
|
|
37645
|
-
|
|
37646
|
-
|
|
37644
|
+
if (!this.smartJumpStartEdge()) {
|
|
37645
|
+
this.updatePaths();
|
|
37646
|
+
this.subject.publish(this);
|
|
37647
|
+
}
|
|
37647
37648
|
}
|
|
37648
37649
|
};
|
|
37649
37650
|
observerEndPointItem = () => {
|
|
37650
37651
|
const point5 = this.endPoint;
|
|
37651
37652
|
if (point5.pointType !== "Board") {
|
|
37652
37653
|
point5.recalculatePoint();
|
|
37653
|
-
this.smartJumpStartEdge()
|
|
37654
|
-
|
|
37655
|
-
|
|
37654
|
+
if (!this.smartJumpStartEdge()) {
|
|
37655
|
+
this.updatePaths();
|
|
37656
|
+
this.subject.publish(this);
|
|
37657
|
+
}
|
|
37656
37658
|
}
|
|
37657
37659
|
};
|
|
37658
37660
|
smartJumpStartEdge() {
|
|
37659
37661
|
const start = this.startPoint;
|
|
37660
37662
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
37661
|
-
return;
|
|
37663
|
+
return false;
|
|
37662
37664
|
const item = start.item;
|
|
37663
37665
|
const anchors = item.getSnapAnchorPoints?.();
|
|
37664
37666
|
if (!anchors || anchors.length === 0)
|
|
37665
|
-
return;
|
|
37667
|
+
return false;
|
|
37666
37668
|
const EPS = 2;
|
|
37667
37669
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
37668
37670
|
if (!isOnAnchor)
|
|
37669
|
-
return;
|
|
37671
|
+
return false;
|
|
37670
37672
|
const center = item.getMbr().getCenter();
|
|
37671
37673
|
const dx = this.endPoint.x - center.x;
|
|
37672
37674
|
const dy = this.endPoint.y - center.y;
|
|
37673
37675
|
if (dx === 0 && dy === 0)
|
|
37674
|
-
return;
|
|
37676
|
+
return false;
|
|
37675
37677
|
let best = anchors[0];
|
|
37676
37678
|
let bestDot = -Infinity;
|
|
37677
37679
|
for (const anchor of anchors) {
|
|
@@ -37687,8 +37689,9 @@ class Connector2 extends BaseItem {
|
|
|
37687
37689
|
}
|
|
37688
37690
|
}
|
|
37689
37691
|
if (Math.abs(best.x - start.x) < EPS && Math.abs(best.y - start.y) < EPS)
|
|
37690
|
-
return;
|
|
37691
|
-
this.
|
|
37692
|
+
return false;
|
|
37693
|
+
this.setStartPoint(new FixedPoint(item, toRelativePoint(best, item)));
|
|
37694
|
+
return true;
|
|
37692
37695
|
}
|
|
37693
37696
|
clearObservedItems() {
|
|
37694
37697
|
const startPoint = this.getStartPoint();
|
|
@@ -40307,16 +40310,10 @@ class Shape extends BaseItem {
|
|
|
40307
40310
|
div.setAttribute("stroke-width", this.borderWidth.toString());
|
|
40308
40311
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40309
40312
|
textElement.id = `${this.getId()}_text`;
|
|
40310
|
-
textElement.style.maxWidth = `${width}px`;
|
|
40311
40313
|
textElement.style.overflow = "auto";
|
|
40312
40314
|
positionRelatively(textElement, div);
|
|
40313
40315
|
resetElementScale(textElement);
|
|
40314
40316
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40315
|
-
const [dx, dy] = [
|
|
40316
|
-
(width - parseInt(textElement.style.width)) / scaleX / 2 - 1,
|
|
40317
|
-
(height - parseInt(textElement.style.height)) / scaleY / 2 - 1
|
|
40318
|
-
];
|
|
40319
|
-
translateElementBy(textElement, dx, dy);
|
|
40320
40317
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
40321
40318
|
if (this.getLinkTo()) {
|
|
40322
40319
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
package/dist/esm/index.js
CHANGED
|
@@ -22288,7 +22288,7 @@ class RichText extends BaseItem {
|
|
|
22288
22288
|
return this.editor.maxWidth || this.container.getWidth();
|
|
22289
22289
|
}
|
|
22290
22290
|
if (this.isContainerSet) {
|
|
22291
|
-
return this.
|
|
22291
|
+
return this.getTransformedContainer().getWidth();
|
|
22292
22292
|
} else {
|
|
22293
22293
|
return this.containerMaxWidth || this.editor.maxWidth;
|
|
22294
22294
|
}
|
|
@@ -37634,37 +37634,39 @@ class Connector2 extends BaseItem {
|
|
|
37634
37634
|
const point5 = this.startPoint;
|
|
37635
37635
|
if (point5.pointType !== "Board") {
|
|
37636
37636
|
point5.recalculatePoint();
|
|
37637
|
-
this.smartJumpStartEdge()
|
|
37638
|
-
|
|
37639
|
-
|
|
37637
|
+
if (!this.smartJumpStartEdge()) {
|
|
37638
|
+
this.updatePaths();
|
|
37639
|
+
this.subject.publish(this);
|
|
37640
|
+
}
|
|
37640
37641
|
}
|
|
37641
37642
|
};
|
|
37642
37643
|
observerEndPointItem = () => {
|
|
37643
37644
|
const point5 = this.endPoint;
|
|
37644
37645
|
if (point5.pointType !== "Board") {
|
|
37645
37646
|
point5.recalculatePoint();
|
|
37646
|
-
this.smartJumpStartEdge()
|
|
37647
|
-
|
|
37648
|
-
|
|
37647
|
+
if (!this.smartJumpStartEdge()) {
|
|
37648
|
+
this.updatePaths();
|
|
37649
|
+
this.subject.publish(this);
|
|
37650
|
+
}
|
|
37649
37651
|
}
|
|
37650
37652
|
};
|
|
37651
37653
|
smartJumpStartEdge() {
|
|
37652
37654
|
const start = this.startPoint;
|
|
37653
37655
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
37654
|
-
return;
|
|
37656
|
+
return false;
|
|
37655
37657
|
const item = start.item;
|
|
37656
37658
|
const anchors = item.getSnapAnchorPoints?.();
|
|
37657
37659
|
if (!anchors || anchors.length === 0)
|
|
37658
|
-
return;
|
|
37660
|
+
return false;
|
|
37659
37661
|
const EPS = 2;
|
|
37660
37662
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
37661
37663
|
if (!isOnAnchor)
|
|
37662
|
-
return;
|
|
37664
|
+
return false;
|
|
37663
37665
|
const center = item.getMbr().getCenter();
|
|
37664
37666
|
const dx = this.endPoint.x - center.x;
|
|
37665
37667
|
const dy = this.endPoint.y - center.y;
|
|
37666
37668
|
if (dx === 0 && dy === 0)
|
|
37667
|
-
return;
|
|
37669
|
+
return false;
|
|
37668
37670
|
let best = anchors[0];
|
|
37669
37671
|
let bestDot = -Infinity;
|
|
37670
37672
|
for (const anchor of anchors) {
|
|
@@ -37680,8 +37682,9 @@ class Connector2 extends BaseItem {
|
|
|
37680
37682
|
}
|
|
37681
37683
|
}
|
|
37682
37684
|
if (Math.abs(best.x - start.x) < EPS && Math.abs(best.y - start.y) < EPS)
|
|
37683
|
-
return;
|
|
37684
|
-
this.
|
|
37685
|
+
return false;
|
|
37686
|
+
this.setStartPoint(new FixedPoint(item, toRelativePoint(best, item)));
|
|
37687
|
+
return true;
|
|
37685
37688
|
}
|
|
37686
37689
|
clearObservedItems() {
|
|
37687
37690
|
const startPoint = this.getStartPoint();
|
|
@@ -40300,16 +40303,10 @@ class Shape extends BaseItem {
|
|
|
40300
40303
|
div.setAttribute("stroke-width", this.borderWidth.toString());
|
|
40301
40304
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40302
40305
|
textElement.id = `${this.getId()}_text`;
|
|
40303
|
-
textElement.style.maxWidth = `${width}px`;
|
|
40304
40306
|
textElement.style.overflow = "auto";
|
|
40305
40307
|
positionRelatively(textElement, div);
|
|
40306
40308
|
resetElementScale(textElement);
|
|
40307
40309
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40308
|
-
const [dx, dy] = [
|
|
40309
|
-
(width - parseInt(textElement.style.width)) / scaleX / 2 - 1,
|
|
40310
|
-
(height - parseInt(textElement.style.height)) / scaleY / 2 - 1
|
|
40311
|
-
];
|
|
40312
|
-
translateElementBy(textElement, dx, dy);
|
|
40313
40310
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
40314
40311
|
if (this.getLinkTo()) {
|
|
40315
40312
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
package/dist/esm/node.js
CHANGED
|
@@ -24755,7 +24755,7 @@ class RichText extends BaseItem {
|
|
|
24755
24755
|
return this.editor.maxWidth || this.container.getWidth();
|
|
24756
24756
|
}
|
|
24757
24757
|
if (this.isContainerSet) {
|
|
24758
|
-
return this.
|
|
24758
|
+
return this.getTransformedContainer().getWidth();
|
|
24759
24759
|
} else {
|
|
24760
24760
|
return this.containerMaxWidth || this.editor.maxWidth;
|
|
24761
24761
|
}
|
|
@@ -40102,37 +40102,39 @@ class Connector2 extends BaseItem {
|
|
|
40102
40102
|
const point5 = this.startPoint;
|
|
40103
40103
|
if (point5.pointType !== "Board") {
|
|
40104
40104
|
point5.recalculatePoint();
|
|
40105
|
-
this.smartJumpStartEdge()
|
|
40106
|
-
|
|
40107
|
-
|
|
40105
|
+
if (!this.smartJumpStartEdge()) {
|
|
40106
|
+
this.updatePaths();
|
|
40107
|
+
this.subject.publish(this);
|
|
40108
|
+
}
|
|
40108
40109
|
}
|
|
40109
40110
|
};
|
|
40110
40111
|
observerEndPointItem = () => {
|
|
40111
40112
|
const point5 = this.endPoint;
|
|
40112
40113
|
if (point5.pointType !== "Board") {
|
|
40113
40114
|
point5.recalculatePoint();
|
|
40114
|
-
this.smartJumpStartEdge()
|
|
40115
|
-
|
|
40116
|
-
|
|
40115
|
+
if (!this.smartJumpStartEdge()) {
|
|
40116
|
+
this.updatePaths();
|
|
40117
|
+
this.subject.publish(this);
|
|
40118
|
+
}
|
|
40117
40119
|
}
|
|
40118
40120
|
};
|
|
40119
40121
|
smartJumpStartEdge() {
|
|
40120
40122
|
const start = this.startPoint;
|
|
40121
40123
|
if (start.pointType !== "Fixed" && start.pointType !== "Floating")
|
|
40122
|
-
return;
|
|
40124
|
+
return false;
|
|
40123
40125
|
const item = start.item;
|
|
40124
40126
|
const anchors = item.getSnapAnchorPoints?.();
|
|
40125
40127
|
if (!anchors || anchors.length === 0)
|
|
40126
|
-
return;
|
|
40128
|
+
return false;
|
|
40127
40129
|
const EPS = 2;
|
|
40128
40130
|
const isOnAnchor = anchors.some((a2) => Math.abs(a2.x - start.x) < EPS && Math.abs(a2.y - start.y) < EPS);
|
|
40129
40131
|
if (!isOnAnchor)
|
|
40130
|
-
return;
|
|
40132
|
+
return false;
|
|
40131
40133
|
const center = item.getMbr().getCenter();
|
|
40132
40134
|
const dx = this.endPoint.x - center.x;
|
|
40133
40135
|
const dy = this.endPoint.y - center.y;
|
|
40134
40136
|
if (dx === 0 && dy === 0)
|
|
40135
|
-
return;
|
|
40137
|
+
return false;
|
|
40136
40138
|
let best = anchors[0];
|
|
40137
40139
|
let bestDot = -Infinity;
|
|
40138
40140
|
for (const anchor of anchors) {
|
|
@@ -40148,8 +40150,9 @@ class Connector2 extends BaseItem {
|
|
|
40148
40150
|
}
|
|
40149
40151
|
}
|
|
40150
40152
|
if (Math.abs(best.x - start.x) < EPS && Math.abs(best.y - start.y) < EPS)
|
|
40151
|
-
return;
|
|
40152
|
-
this.
|
|
40153
|
+
return false;
|
|
40154
|
+
this.setStartPoint(new FixedPoint(item, toRelativePoint(best, item)));
|
|
40155
|
+
return true;
|
|
40153
40156
|
}
|
|
40154
40157
|
clearObservedItems() {
|
|
40155
40158
|
const startPoint = this.getStartPoint();
|
|
@@ -42768,16 +42771,10 @@ class Shape extends BaseItem {
|
|
|
42768
42771
|
div.setAttribute("stroke-width", this.borderWidth.toString());
|
|
42769
42772
|
const textElement = this.text.renderHTML(documentFactory);
|
|
42770
42773
|
textElement.id = `${this.getId()}_text`;
|
|
42771
|
-
textElement.style.maxWidth = `${width}px`;
|
|
42772
42774
|
textElement.style.overflow = "auto";
|
|
42773
42775
|
positionRelatively(textElement, div);
|
|
42774
42776
|
resetElementScale(textElement);
|
|
42775
42777
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
42776
|
-
const [dx, dy] = [
|
|
42777
|
-
(width - parseInt(textElement.style.width)) / scaleX / 2 - 1,
|
|
42778
|
-
(height - parseInt(textElement.style.height)) / scaleY / 2 - 1
|
|
42779
|
-
];
|
|
42780
|
-
translateElementBy(textElement, dx, dy);
|
|
42781
42778
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
42782
42779
|
if (this.getLinkTo()) {
|
|
42783
42780
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
|
@@ -60,7 +60,8 @@ export declare class Connector extends BaseItem {
|
|
|
60
60
|
/**
|
|
61
61
|
* If the start point is attached to one of the 4 edge-center anchors, re-evaluate
|
|
62
62
|
* which edge best faces the current end position and jump there to avoid sharp bends.
|
|
63
|
-
*
|
|
63
|
+
* Emits a setStartPoint operation so the jump is persisted and synced.
|
|
64
|
+
* Returns true if a jump was performed (caller should skip its own updatePaths/publish).
|
|
64
65
|
*/
|
|
65
66
|
private smartJumpStartEdge;
|
|
66
67
|
clearObservedItems(): void;
|