microboard-temp 0.4.43 → 0.4.45

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.
@@ -20870,14 +20870,10 @@ class SpatialIndex {
20870
20870
  const items = this.itemsIndex.getEnclosed(mbr);
20871
20871
  const children = [];
20872
20872
  items.forEach((item) => {
20873
- const children2 = this.getItemChildren(item);
20874
- children2.forEach((child) => {
20875
- if (child.isEnclosedBy(mbr)) {
20876
- children2.push(child);
20877
- }
20878
- });
20873
+ if ("index" in item && item.index) {
20874
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
20875
+ }
20879
20876
  });
20880
- console.log([...items, ...children]);
20881
20877
  return [...items, ...children];
20882
20878
  }
20883
20879
  getEnclosedOrCrossed(left, top, right, bottom) {
@@ -20885,28 +20881,20 @@ class SpatialIndex {
20885
20881
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
20886
20882
  const children = [];
20887
20883
  items.forEach((item) => {
20888
- const children2 = this.getItemChildren(item);
20889
- children2.forEach((child) => {
20890
- if (child.isEnclosedOrCrossedBy(mbr)) {
20891
- children2.push(child);
20892
- }
20893
- });
20884
+ if ("index" in item && item.index) {
20885
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20886
+ }
20894
20887
  });
20895
- console.log([...items, ...children]);
20896
20888
  return [...items, ...children];
20897
20889
  }
20898
20890
  getUnderPoint(point3, tolerance = 5) {
20899
20891
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
20900
20892
  const children = [];
20901
20893
  items.forEach((item) => {
20902
- const children2 = this.getItemChildren(item);
20903
- children2.forEach((child) => {
20904
- if (child.isUnderPoint(point3, tolerance)) {
20905
- children2.push(child);
20906
- }
20907
- });
20894
+ if ("index" in item && item.index) {
20895
+ children.push(...item.index.getUnderPoint(point3, tolerance));
20896
+ }
20908
20897
  });
20909
- console.log([...items, ...children]);
20910
20898
  return [...items, ...children];
20911
20899
  }
20912
20900
  getRectsEnclosedOrCrossed(left, top, right, bottom) {
@@ -20914,14 +20902,12 @@ class SpatialIndex {
20914
20902
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
20915
20903
  const children = [];
20916
20904
  items.forEach((item) => {
20917
- const children2 = this.getItemChildren(item);
20918
- children2.forEach((child) => {
20919
- if (child.isEnclosedOrCrossedBy(mbr)) {
20920
- children2.push(child);
20905
+ items.forEach((item2) => {
20906
+ if ("index" in item2 && item2.index) {
20907
+ children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20921
20908
  }
20922
20909
  });
20923
20910
  });
20924
- console.log([...items, ...children]);
20925
20911
  return [...items, ...children];
20926
20912
  }
20927
20913
  getItemsEnclosedOrCrossed(left, top, right, bottom) {
@@ -20941,11 +20927,9 @@ class SpatialIndex {
20941
20927
  distance: point3.getDistance(item.getMbr().getCenter())
20942
20928
  })).filter(({ distance }) => distance <= maxDistance);
20943
20929
  withDistance.sort((a, b) => a.distance - b.distance);
20944
- console.log(withDistance.slice(0, maxItems).map(({ item }) => item));
20945
20930
  return withDistance.slice(0, maxItems).map(({ item }) => item);
20946
20931
  }
20947
20932
  list() {
20948
- console.log("list", this.getItemsWithIncludedChildren(this.itemsArray).concat());
20949
20933
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
20950
20934
  }
20951
20935
  getZIndex(item) {
@@ -20986,7 +20970,7 @@ class Items {
20986
20970
  return this.index.list();
20987
20971
  }
20988
20972
  listGroupItems() {
20989
- return this.index.list().filter((item) => ("getChildrenIds" in item) && item.getChildrenIds());
20973
+ return this.index.list().filter((item) => ("index" in item) && item.index);
20990
20974
  }
20991
20975
  getById(id) {
20992
20976
  return this.index.getById(id);
@@ -21001,7 +20985,7 @@ class Items {
21001
20985
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
21002
20986
  }
21003
20987
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
21004
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.getChildrenIds());
20988
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
21005
20989
  }
21006
20990
  getUnderPoint(point3, tolerance = 5) {
21007
20991
  return this.index.getUnderPoint(point3, tolerance);
@@ -40292,7 +40276,7 @@ class Frame2 extends BaseItem {
40292
40276
  return this.id;
40293
40277
  }
40294
40278
  getChildrenIds() {
40295
- return this.children;
40279
+ return this.index?.list().map((item) => item.getId()) || [];
40296
40280
  }
40297
40281
  updateMbr() {
40298
40282
  const rect = this.path.getMbr().copy();
@@ -52260,7 +52244,7 @@ class BoardSelection {
52260
52244
  };
52261
52245
  }
52262
52246
  function tryToAddFrameChildrenToTranslation(selectedItem) {
52263
- if (!(selectedItem instanceof Frame2)) {
52247
+ if (!("index" in selectedItem) && !selectedItem.index) {
52264
52248
  return;
52265
52249
  }
52266
52250
  for (const childId of selectedItem.getChildrenIds()) {
package/dist/cjs/index.js CHANGED
@@ -20870,14 +20870,10 @@ class SpatialIndex {
20870
20870
  const items = this.itemsIndex.getEnclosed(mbr);
20871
20871
  const children = [];
20872
20872
  items.forEach((item) => {
20873
- const children2 = this.getItemChildren(item);
20874
- children2.forEach((child) => {
20875
- if (child.isEnclosedBy(mbr)) {
20876
- children2.push(child);
20877
- }
20878
- });
20873
+ if ("index" in item && item.index) {
20874
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
20875
+ }
20879
20876
  });
20880
- console.log([...items, ...children]);
20881
20877
  return [...items, ...children];
20882
20878
  }
20883
20879
  getEnclosedOrCrossed(left, top, right, bottom) {
@@ -20885,28 +20881,20 @@ class SpatialIndex {
20885
20881
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
20886
20882
  const children = [];
20887
20883
  items.forEach((item) => {
20888
- const children2 = this.getItemChildren(item);
20889
- children2.forEach((child) => {
20890
- if (child.isEnclosedOrCrossedBy(mbr)) {
20891
- children2.push(child);
20892
- }
20893
- });
20884
+ if ("index" in item && item.index) {
20885
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20886
+ }
20894
20887
  });
20895
- console.log([...items, ...children]);
20896
20888
  return [...items, ...children];
20897
20889
  }
20898
20890
  getUnderPoint(point3, tolerance = 5) {
20899
20891
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
20900
20892
  const children = [];
20901
20893
  items.forEach((item) => {
20902
- const children2 = this.getItemChildren(item);
20903
- children2.forEach((child) => {
20904
- if (child.isUnderPoint(point3, tolerance)) {
20905
- children2.push(child);
20906
- }
20907
- });
20894
+ if ("index" in item && item.index) {
20895
+ children.push(...item.index.getUnderPoint(point3, tolerance));
20896
+ }
20908
20897
  });
20909
- console.log([...items, ...children]);
20910
20898
  return [...items, ...children];
20911
20899
  }
20912
20900
  getRectsEnclosedOrCrossed(left, top, right, bottom) {
@@ -20914,14 +20902,12 @@ class SpatialIndex {
20914
20902
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
20915
20903
  const children = [];
20916
20904
  items.forEach((item) => {
20917
- const children2 = this.getItemChildren(item);
20918
- children2.forEach((child) => {
20919
- if (child.isEnclosedOrCrossedBy(mbr)) {
20920
- children2.push(child);
20905
+ items.forEach((item2) => {
20906
+ if ("index" in item2 && item2.index) {
20907
+ children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20921
20908
  }
20922
20909
  });
20923
20910
  });
20924
- console.log([...items, ...children]);
20925
20911
  return [...items, ...children];
20926
20912
  }
20927
20913
  getItemsEnclosedOrCrossed(left, top, right, bottom) {
@@ -20941,11 +20927,9 @@ class SpatialIndex {
20941
20927
  distance: point3.getDistance(item.getMbr().getCenter())
20942
20928
  })).filter(({ distance }) => distance <= maxDistance);
20943
20929
  withDistance.sort((a, b) => a.distance - b.distance);
20944
- console.log(withDistance.slice(0, maxItems).map(({ item }) => item));
20945
20930
  return withDistance.slice(0, maxItems).map(({ item }) => item);
20946
20931
  }
20947
20932
  list() {
20948
- console.log("list", this.getItemsWithIncludedChildren(this.itemsArray).concat());
20949
20933
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
20950
20934
  }
20951
20935
  getZIndex(item) {
@@ -20986,7 +20970,7 @@ class Items {
20986
20970
  return this.index.list();
20987
20971
  }
20988
20972
  listGroupItems() {
20989
- return this.index.list().filter((item) => ("getChildrenIds" in item) && item.getChildrenIds());
20973
+ return this.index.list().filter((item) => ("index" in item) && item.index);
20990
20974
  }
20991
20975
  getById(id) {
20992
20976
  return this.index.getById(id);
@@ -21001,7 +20985,7 @@ class Items {
21001
20985
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
21002
20986
  }
21003
20987
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
21004
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.getChildrenIds());
20988
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
21005
20989
  }
21006
20990
  getUnderPoint(point3, tolerance = 5) {
21007
20991
  return this.index.getUnderPoint(point3, tolerance);
@@ -40292,7 +40276,7 @@ class Frame2 extends BaseItem {
40292
40276
  return this.id;
40293
40277
  }
40294
40278
  getChildrenIds() {
40295
- return this.children;
40279
+ return this.index?.list().map((item) => item.getId()) || [];
40296
40280
  }
40297
40281
  updateMbr() {
40298
40282
  const rect = this.path.getMbr().copy();
@@ -52260,7 +52244,7 @@ class BoardSelection {
52260
52244
  };
52261
52245
  }
52262
52246
  function tryToAddFrameChildrenToTranslation(selectedItem) {
52263
- if (!(selectedItem instanceof Frame2)) {
52247
+ if (!("index" in selectedItem) && !selectedItem.index) {
52264
52248
  return;
52265
52249
  }
52266
52250
  for (const childId of selectedItem.getChildrenIds()) {
package/dist/cjs/node.js CHANGED
@@ -23342,14 +23342,10 @@ class SpatialIndex {
23342
23342
  const items = this.itemsIndex.getEnclosed(mbr);
23343
23343
  const children = [];
23344
23344
  items.forEach((item) => {
23345
- const children2 = this.getItemChildren(item);
23346
- children2.forEach((child) => {
23347
- if (child.isEnclosedBy(mbr)) {
23348
- children2.push(child);
23349
- }
23350
- });
23345
+ if ("index" in item && item.index) {
23346
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
23347
+ }
23351
23348
  });
23352
- console.log([...items, ...children]);
23353
23349
  return [...items, ...children];
23354
23350
  }
23355
23351
  getEnclosedOrCrossed(left, top, right, bottom) {
@@ -23357,28 +23353,20 @@ class SpatialIndex {
23357
23353
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
23358
23354
  const children = [];
23359
23355
  items.forEach((item) => {
23360
- const children2 = this.getItemChildren(item);
23361
- children2.forEach((child) => {
23362
- if (child.isEnclosedOrCrossedBy(mbr)) {
23363
- children2.push(child);
23364
- }
23365
- });
23356
+ if ("index" in item && item.index) {
23357
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
23358
+ }
23366
23359
  });
23367
- console.log([...items, ...children]);
23368
23360
  return [...items, ...children];
23369
23361
  }
23370
23362
  getUnderPoint(point3, tolerance = 5) {
23371
23363
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
23372
23364
  const children = [];
23373
23365
  items.forEach((item) => {
23374
- const children2 = this.getItemChildren(item);
23375
- children2.forEach((child) => {
23376
- if (child.isUnderPoint(point3, tolerance)) {
23377
- children2.push(child);
23378
- }
23379
- });
23366
+ if ("index" in item && item.index) {
23367
+ children.push(...item.index.getUnderPoint(point3, tolerance));
23368
+ }
23380
23369
  });
23381
- console.log([...items, ...children]);
23382
23370
  return [...items, ...children];
23383
23371
  }
23384
23372
  getRectsEnclosedOrCrossed(left, top, right, bottom) {
@@ -23386,14 +23374,12 @@ class SpatialIndex {
23386
23374
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
23387
23375
  const children = [];
23388
23376
  items.forEach((item) => {
23389
- const children2 = this.getItemChildren(item);
23390
- children2.forEach((child) => {
23391
- if (child.isEnclosedOrCrossedBy(mbr)) {
23392
- children2.push(child);
23377
+ items.forEach((item2) => {
23378
+ if ("index" in item2 && item2.index) {
23379
+ children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
23393
23380
  }
23394
23381
  });
23395
23382
  });
23396
- console.log([...items, ...children]);
23397
23383
  return [...items, ...children];
23398
23384
  }
23399
23385
  getItemsEnclosedOrCrossed(left, top, right, bottom) {
@@ -23413,11 +23399,9 @@ class SpatialIndex {
23413
23399
  distance: point3.getDistance(item.getMbr().getCenter())
23414
23400
  })).filter(({ distance }) => distance <= maxDistance);
23415
23401
  withDistance.sort((a, b) => a.distance - b.distance);
23416
- console.log(withDistance.slice(0, maxItems).map(({ item }) => item));
23417
23402
  return withDistance.slice(0, maxItems).map(({ item }) => item);
23418
23403
  }
23419
23404
  list() {
23420
- console.log("list", this.getItemsWithIncludedChildren(this.itemsArray).concat());
23421
23405
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
23422
23406
  }
23423
23407
  getZIndex(item) {
@@ -23458,7 +23442,7 @@ class Items {
23458
23442
  return this.index.list();
23459
23443
  }
23460
23444
  listGroupItems() {
23461
- return this.index.list().filter((item) => ("getChildrenIds" in item) && item.getChildrenIds());
23445
+ return this.index.list().filter((item) => ("index" in item) && item.index);
23462
23446
  }
23463
23447
  getById(id) {
23464
23448
  return this.index.getById(id);
@@ -23473,7 +23457,7 @@ class Items {
23473
23457
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
23474
23458
  }
23475
23459
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
23476
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.getChildrenIds());
23460
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
23477
23461
  }
23478
23462
  getUnderPoint(point3, tolerance = 5) {
23479
23463
  return this.index.getUnderPoint(point3, tolerance);
@@ -42765,7 +42749,7 @@ class Frame2 extends BaseItem {
42765
42749
  return this.id;
42766
42750
  }
42767
42751
  getChildrenIds() {
42768
- return this.children;
42752
+ return this.index?.list().map((item) => item.getId()) || [];
42769
42753
  }
42770
42754
  updateMbr() {
42771
42755
  const rect = this.path.getMbr().copy();
@@ -54733,7 +54717,7 @@ class BoardSelection {
54733
54717
  };
54734
54718
  }
54735
54719
  function tryToAddFrameChildrenToTranslation(selectedItem) {
54736
- if (!(selectedItem instanceof Frame2)) {
54720
+ if (!("index" in selectedItem) && !selectedItem.index) {
54737
54721
  return;
54738
54722
  }
54739
54723
  for (const childId of selectedItem.getChildrenIds()) {
@@ -20720,14 +20720,10 @@ class SpatialIndex {
20720
20720
  const items = this.itemsIndex.getEnclosed(mbr);
20721
20721
  const children = [];
20722
20722
  items.forEach((item) => {
20723
- const children2 = this.getItemChildren(item);
20724
- children2.forEach((child) => {
20725
- if (child.isEnclosedBy(mbr)) {
20726
- children2.push(child);
20727
- }
20728
- });
20723
+ if ("index" in item && item.index) {
20724
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
20725
+ }
20729
20726
  });
20730
- console.log([...items, ...children]);
20731
20727
  return [...items, ...children];
20732
20728
  }
20733
20729
  getEnclosedOrCrossed(left, top, right, bottom) {
@@ -20735,28 +20731,20 @@ class SpatialIndex {
20735
20731
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
20736
20732
  const children = [];
20737
20733
  items.forEach((item) => {
20738
- const children2 = this.getItemChildren(item);
20739
- children2.forEach((child) => {
20740
- if (child.isEnclosedOrCrossedBy(mbr)) {
20741
- children2.push(child);
20742
- }
20743
- });
20734
+ if ("index" in item && item.index) {
20735
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20736
+ }
20744
20737
  });
20745
- console.log([...items, ...children]);
20746
20738
  return [...items, ...children];
20747
20739
  }
20748
20740
  getUnderPoint(point3, tolerance = 5) {
20749
20741
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
20750
20742
  const children = [];
20751
20743
  items.forEach((item) => {
20752
- const children2 = this.getItemChildren(item);
20753
- children2.forEach((child) => {
20754
- if (child.isUnderPoint(point3, tolerance)) {
20755
- children2.push(child);
20756
- }
20757
- });
20744
+ if ("index" in item && item.index) {
20745
+ children.push(...item.index.getUnderPoint(point3, tolerance));
20746
+ }
20758
20747
  });
20759
- console.log([...items, ...children]);
20760
20748
  return [...items, ...children];
20761
20749
  }
20762
20750
  getRectsEnclosedOrCrossed(left, top, right, bottom) {
@@ -20764,14 +20752,12 @@ class SpatialIndex {
20764
20752
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
20765
20753
  const children = [];
20766
20754
  items.forEach((item) => {
20767
- const children2 = this.getItemChildren(item);
20768
- children2.forEach((child) => {
20769
- if (child.isEnclosedOrCrossedBy(mbr)) {
20770
- children2.push(child);
20755
+ items.forEach((item2) => {
20756
+ if ("index" in item2 && item2.index) {
20757
+ children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20771
20758
  }
20772
20759
  });
20773
20760
  });
20774
- console.log([...items, ...children]);
20775
20761
  return [...items, ...children];
20776
20762
  }
20777
20763
  getItemsEnclosedOrCrossed(left, top, right, bottom) {
@@ -20791,11 +20777,9 @@ class SpatialIndex {
20791
20777
  distance: point3.getDistance(item.getMbr().getCenter())
20792
20778
  })).filter(({ distance }) => distance <= maxDistance);
20793
20779
  withDistance.sort((a, b) => a.distance - b.distance);
20794
- console.log(withDistance.slice(0, maxItems).map(({ item }) => item));
20795
20780
  return withDistance.slice(0, maxItems).map(({ item }) => item);
20796
20781
  }
20797
20782
  list() {
20798
- console.log("list", this.getItemsWithIncludedChildren(this.itemsArray).concat());
20799
20783
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
20800
20784
  }
20801
20785
  getZIndex(item) {
@@ -20836,7 +20820,7 @@ class Items {
20836
20820
  return this.index.list();
20837
20821
  }
20838
20822
  listGroupItems() {
20839
- return this.index.list().filter((item) => ("getChildrenIds" in item) && item.getChildrenIds());
20823
+ return this.index.list().filter((item) => ("index" in item) && item.index);
20840
20824
  }
20841
20825
  getById(id) {
20842
20826
  return this.index.getById(id);
@@ -20851,7 +20835,7 @@ class Items {
20851
20835
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
20852
20836
  }
20853
20837
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
20854
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.getChildrenIds());
20838
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
20855
20839
  }
20856
20840
  getUnderPoint(point3, tolerance = 5) {
20857
20841
  return this.index.getUnderPoint(point3, tolerance);
@@ -40142,7 +40126,7 @@ class Frame2 extends BaseItem {
40142
40126
  return this.id;
40143
40127
  }
40144
40128
  getChildrenIds() {
40145
- return this.children;
40129
+ return this.index?.list().map((item) => item.getId()) || [];
40146
40130
  }
40147
40131
  updateMbr() {
40148
40132
  const rect = this.path.getMbr().copy();
@@ -52110,7 +52094,7 @@ class BoardSelection {
52110
52094
  };
52111
52095
  }
52112
52096
  function tryToAddFrameChildrenToTranslation(selectedItem) {
52113
- if (!(selectedItem instanceof Frame2)) {
52097
+ if (!("index" in selectedItem) && !selectedItem.index) {
52114
52098
  return;
52115
52099
  }
52116
52100
  for (const childId of selectedItem.getChildrenIds()) {
package/dist/esm/index.js CHANGED
@@ -20713,14 +20713,10 @@ class SpatialIndex {
20713
20713
  const items = this.itemsIndex.getEnclosed(mbr);
20714
20714
  const children = [];
20715
20715
  items.forEach((item) => {
20716
- const children2 = this.getItemChildren(item);
20717
- children2.forEach((child) => {
20718
- if (child.isEnclosedBy(mbr)) {
20719
- children2.push(child);
20720
- }
20721
- });
20716
+ if ("index" in item && item.index) {
20717
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
20718
+ }
20722
20719
  });
20723
- console.log([...items, ...children]);
20724
20720
  return [...items, ...children];
20725
20721
  }
20726
20722
  getEnclosedOrCrossed(left, top, right, bottom) {
@@ -20728,28 +20724,20 @@ class SpatialIndex {
20728
20724
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
20729
20725
  const children = [];
20730
20726
  items.forEach((item) => {
20731
- const children2 = this.getItemChildren(item);
20732
- children2.forEach((child) => {
20733
- if (child.isEnclosedOrCrossedBy(mbr)) {
20734
- children2.push(child);
20735
- }
20736
- });
20727
+ if ("index" in item && item.index) {
20728
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20729
+ }
20737
20730
  });
20738
- console.log([...items, ...children]);
20739
20731
  return [...items, ...children];
20740
20732
  }
20741
20733
  getUnderPoint(point3, tolerance = 5) {
20742
20734
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
20743
20735
  const children = [];
20744
20736
  items.forEach((item) => {
20745
- const children2 = this.getItemChildren(item);
20746
- children2.forEach((child) => {
20747
- if (child.isUnderPoint(point3, tolerance)) {
20748
- children2.push(child);
20749
- }
20750
- });
20737
+ if ("index" in item && item.index) {
20738
+ children.push(...item.index.getUnderPoint(point3, tolerance));
20739
+ }
20751
20740
  });
20752
- console.log([...items, ...children]);
20753
20741
  return [...items, ...children];
20754
20742
  }
20755
20743
  getRectsEnclosedOrCrossed(left, top, right, bottom) {
@@ -20757,14 +20745,12 @@ class SpatialIndex {
20757
20745
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
20758
20746
  const children = [];
20759
20747
  items.forEach((item) => {
20760
- const children2 = this.getItemChildren(item);
20761
- children2.forEach((child) => {
20762
- if (child.isEnclosedOrCrossedBy(mbr)) {
20763
- children2.push(child);
20748
+ items.forEach((item2) => {
20749
+ if ("index" in item2 && item2.index) {
20750
+ children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20764
20751
  }
20765
20752
  });
20766
20753
  });
20767
- console.log([...items, ...children]);
20768
20754
  return [...items, ...children];
20769
20755
  }
20770
20756
  getItemsEnclosedOrCrossed(left, top, right, bottom) {
@@ -20784,11 +20770,9 @@ class SpatialIndex {
20784
20770
  distance: point3.getDistance(item.getMbr().getCenter())
20785
20771
  })).filter(({ distance }) => distance <= maxDistance);
20786
20772
  withDistance.sort((a, b) => a.distance - b.distance);
20787
- console.log(withDistance.slice(0, maxItems).map(({ item }) => item));
20788
20773
  return withDistance.slice(0, maxItems).map(({ item }) => item);
20789
20774
  }
20790
20775
  list() {
20791
- console.log("list", this.getItemsWithIncludedChildren(this.itemsArray).concat());
20792
20776
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
20793
20777
  }
20794
20778
  getZIndex(item) {
@@ -20829,7 +20813,7 @@ class Items {
20829
20813
  return this.index.list();
20830
20814
  }
20831
20815
  listGroupItems() {
20832
- return this.index.list().filter((item) => ("getChildrenIds" in item) && item.getChildrenIds());
20816
+ return this.index.list().filter((item) => ("index" in item) && item.index);
20833
20817
  }
20834
20818
  getById(id) {
20835
20819
  return this.index.getById(id);
@@ -20844,7 +20828,7 @@ class Items {
20844
20828
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
20845
20829
  }
20846
20830
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
20847
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.getChildrenIds());
20831
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
20848
20832
  }
20849
20833
  getUnderPoint(point3, tolerance = 5) {
20850
20834
  return this.index.getUnderPoint(point3, tolerance);
@@ -40135,7 +40119,7 @@ class Frame2 extends BaseItem {
40135
40119
  return this.id;
40136
40120
  }
40137
40121
  getChildrenIds() {
40138
- return this.children;
40122
+ return this.index?.list().map((item) => item.getId()) || [];
40139
40123
  }
40140
40124
  updateMbr() {
40141
40125
  const rect = this.path.getMbr().copy();
@@ -52103,7 +52087,7 @@ class BoardSelection {
52103
52087
  };
52104
52088
  }
52105
52089
  function tryToAddFrameChildrenToTranslation(selectedItem) {
52106
- if (!(selectedItem instanceof Frame2)) {
52090
+ if (!("index" in selectedItem) && !selectedItem.index) {
52107
52091
  return;
52108
52092
  }
52109
52093
  for (const childId of selectedItem.getChildrenIds()) {
package/dist/esm/node.js CHANGED
@@ -23180,14 +23180,10 @@ class SpatialIndex {
23180
23180
  const items = this.itemsIndex.getEnclosed(mbr);
23181
23181
  const children = [];
23182
23182
  items.forEach((item) => {
23183
- const children2 = this.getItemChildren(item);
23184
- children2.forEach((child) => {
23185
- if (child.isEnclosedBy(mbr)) {
23186
- children2.push(child);
23187
- }
23188
- });
23183
+ if ("index" in item && item.index) {
23184
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
23185
+ }
23189
23186
  });
23190
- console.log([...items, ...children]);
23191
23187
  return [...items, ...children];
23192
23188
  }
23193
23189
  getEnclosedOrCrossed(left, top, right, bottom) {
@@ -23195,28 +23191,20 @@ class SpatialIndex {
23195
23191
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
23196
23192
  const children = [];
23197
23193
  items.forEach((item) => {
23198
- const children2 = this.getItemChildren(item);
23199
- children2.forEach((child) => {
23200
- if (child.isEnclosedOrCrossedBy(mbr)) {
23201
- children2.push(child);
23202
- }
23203
- });
23194
+ if ("index" in item && item.index) {
23195
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
23196
+ }
23204
23197
  });
23205
- console.log([...items, ...children]);
23206
23198
  return [...items, ...children];
23207
23199
  }
23208
23200
  getUnderPoint(point3, tolerance = 5) {
23209
23201
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
23210
23202
  const children = [];
23211
23203
  items.forEach((item) => {
23212
- const children2 = this.getItemChildren(item);
23213
- children2.forEach((child) => {
23214
- if (child.isUnderPoint(point3, tolerance)) {
23215
- children2.push(child);
23216
- }
23217
- });
23204
+ if ("index" in item && item.index) {
23205
+ children.push(...item.index.getUnderPoint(point3, tolerance));
23206
+ }
23218
23207
  });
23219
- console.log([...items, ...children]);
23220
23208
  return [...items, ...children];
23221
23209
  }
23222
23210
  getRectsEnclosedOrCrossed(left, top, right, bottom) {
@@ -23224,14 +23212,12 @@ class SpatialIndex {
23224
23212
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
23225
23213
  const children = [];
23226
23214
  items.forEach((item) => {
23227
- const children2 = this.getItemChildren(item);
23228
- children2.forEach((child) => {
23229
- if (child.isEnclosedOrCrossedBy(mbr)) {
23230
- children2.push(child);
23215
+ items.forEach((item2) => {
23216
+ if ("index" in item2 && item2.index) {
23217
+ children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
23231
23218
  }
23232
23219
  });
23233
23220
  });
23234
- console.log([...items, ...children]);
23235
23221
  return [...items, ...children];
23236
23222
  }
23237
23223
  getItemsEnclosedOrCrossed(left, top, right, bottom) {
@@ -23251,11 +23237,9 @@ class SpatialIndex {
23251
23237
  distance: point3.getDistance(item.getMbr().getCenter())
23252
23238
  })).filter(({ distance }) => distance <= maxDistance);
23253
23239
  withDistance.sort((a, b) => a.distance - b.distance);
23254
- console.log(withDistance.slice(0, maxItems).map(({ item }) => item));
23255
23240
  return withDistance.slice(0, maxItems).map(({ item }) => item);
23256
23241
  }
23257
23242
  list() {
23258
- console.log("list", this.getItemsWithIncludedChildren(this.itemsArray).concat());
23259
23243
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
23260
23244
  }
23261
23245
  getZIndex(item) {
@@ -23296,7 +23280,7 @@ class Items {
23296
23280
  return this.index.list();
23297
23281
  }
23298
23282
  listGroupItems() {
23299
- return this.index.list().filter((item) => ("getChildrenIds" in item) && item.getChildrenIds());
23283
+ return this.index.list().filter((item) => ("index" in item) && item.index);
23300
23284
  }
23301
23285
  getById(id) {
23302
23286
  return this.index.getById(id);
@@ -23311,7 +23295,7 @@ class Items {
23311
23295
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
23312
23296
  }
23313
23297
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
23314
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.getChildrenIds());
23298
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
23315
23299
  }
23316
23300
  getUnderPoint(point3, tolerance = 5) {
23317
23301
  return this.index.getUnderPoint(point3, tolerance);
@@ -42603,7 +42587,7 @@ class Frame2 extends BaseItem {
42603
42587
  return this.id;
42604
42588
  }
42605
42589
  getChildrenIds() {
42606
- return this.children;
42590
+ return this.index?.list().map((item) => item.getId()) || [];
42607
42591
  }
42608
42592
  updateMbr() {
42609
42593
  const rect = this.path.getMbr().copy();
@@ -54571,7 +54555,7 @@ class BoardSelection {
54571
54555
  };
54572
54556
  }
54573
54557
  function tryToAddFrameChildrenToTranslation(selectedItem) {
54574
- if (!(selectedItem instanceof Frame2)) {
54558
+ if (!("index" in selectedItem) && !selectedItem.index) {
54575
54559
  return;
54576
54560
  }
54577
54561
  for (const childId of selectedItem.getChildrenIds()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.4.43",
3
+ "version": "0.4.45",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",