microboard-temp 0.13.29 → 0.13.30

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.
@@ -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
- this.updatePaths();
37817
- this.subject.publish(this);
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
- this.updatePaths();
37826
- this.subject.publish(this);
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.startPoint = new FixedPoint(item, toRelativePoint(best, item));
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();
package/dist/cjs/index.js CHANGED
@@ -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
- this.updatePaths();
37817
- this.subject.publish(this);
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
- this.updatePaths();
37826
- this.subject.publish(this);
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.startPoint = new FixedPoint(item, toRelativePoint(best, item));
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();
package/dist/cjs/node.js CHANGED
@@ -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
- this.updatePaths();
40290
- this.subject.publish(this);
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
- this.updatePaths();
40299
- this.subject.publish(this);
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.startPoint = new FixedPoint(item, toRelativePoint(best, item));
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();
@@ -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
- this.updatePaths();
37646
- this.subject.publish(this);
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
- this.updatePaths();
37655
- this.subject.publish(this);
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.startPoint = new FixedPoint(item, toRelativePoint(best, item));
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();
package/dist/esm/index.js CHANGED
@@ -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
- this.updatePaths();
37639
- this.subject.publish(this);
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
- this.updatePaths();
37648
- this.subject.publish(this);
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.startPoint = new FixedPoint(item, toRelativePoint(best, item));
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();
package/dist/esm/node.js CHANGED
@@ -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
- this.updatePaths();
40107
- this.subject.publish(this);
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
- this.updatePaths();
40116
- this.subject.publish(this);
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.startPoint = new FixedPoint(item, toRelativePoint(best, item));
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();
@@ -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
- * Purely local/visual no operation is emitted.
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.29",
3
+ "version": "0.13.30",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",