microboard-temp 0.5.36 → 0.5.38

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.
@@ -21044,13 +21044,14 @@ class SpatialIndex {
21044
21044
  return this.Mbr;
21045
21045
  }
21046
21046
  getNearestTo(point3, maxItems, filter, maxDistance) {
21047
- const nearestItems = this.itemsIndex.getNearestTo(point3, maxItems, filter, maxDistance);
21048
- nearestItems.sort((aa, bb) => {
21049
- const distA = point3.getDistance(aa.getMbr().getCenter());
21050
- const distB = point3.getDistance(bb.getMbr().getCenter());
21051
- return distA - distB;
21052
- });
21053
- return nearestItems.slice(0, maxItems);
21047
+ const items = this.getItemsWithIncludedChildren(this.itemsArray);
21048
+ const filteredItems = filter ? items.filter(filter) : items;
21049
+ const itemsWithDistance = filteredItems.map((item) => ({
21050
+ item,
21051
+ distance: item.getMbr().getDistanceToPoint(point3)
21052
+ }));
21053
+ const inRange = itemsWithDistance.filter((x) => x.distance <= maxDistance);
21054
+ return inRange.sort((a, b) => a.distance - b.distance).slice(0, maxItems).map((x) => x.item);
21054
21055
  }
21055
21056
  list() {
21056
21057
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
@@ -21723,7 +21724,7 @@ class BaseItem extends Mbr {
21723
21724
  return this.getMbr().combine(this.index.getMbr());
21724
21725
  }
21725
21726
  getPath() {
21726
- return new Path(this.getMbr().getLines());
21727
+ return new Path(this.getMbr().getLines(), true);
21727
21728
  }
21728
21729
  render(context) {
21729
21730
  if (this.index) {
package/dist/cjs/index.js CHANGED
@@ -21044,13 +21044,14 @@ class SpatialIndex {
21044
21044
  return this.Mbr;
21045
21045
  }
21046
21046
  getNearestTo(point3, maxItems, filter, maxDistance) {
21047
- const nearestItems = this.itemsIndex.getNearestTo(point3, maxItems, filter, maxDistance);
21048
- nearestItems.sort((aa, bb) => {
21049
- const distA = point3.getDistance(aa.getMbr().getCenter());
21050
- const distB = point3.getDistance(bb.getMbr().getCenter());
21051
- return distA - distB;
21052
- });
21053
- return nearestItems.slice(0, maxItems);
21047
+ const items = this.getItemsWithIncludedChildren(this.itemsArray);
21048
+ const filteredItems = filter ? items.filter(filter) : items;
21049
+ const itemsWithDistance = filteredItems.map((item) => ({
21050
+ item,
21051
+ distance: item.getMbr().getDistanceToPoint(point3)
21052
+ }));
21053
+ const inRange = itemsWithDistance.filter((x) => x.distance <= maxDistance);
21054
+ return inRange.sort((a, b) => a.distance - b.distance).slice(0, maxItems).map((x) => x.item);
21054
21055
  }
21055
21056
  list() {
21056
21057
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
@@ -21723,7 +21724,7 @@ class BaseItem extends Mbr {
21723
21724
  return this.getMbr().combine(this.index.getMbr());
21724
21725
  }
21725
21726
  getPath() {
21726
- return new Path(this.getMbr().getLines());
21727
+ return new Path(this.getMbr().getLines(), true);
21727
21728
  }
21728
21729
  render(context) {
21729
21730
  if (this.index) {
package/dist/cjs/node.js CHANGED
@@ -23516,13 +23516,14 @@ class SpatialIndex {
23516
23516
  return this.Mbr;
23517
23517
  }
23518
23518
  getNearestTo(point3, maxItems, filter, maxDistance) {
23519
- const nearestItems = this.itemsIndex.getNearestTo(point3, maxItems, filter, maxDistance);
23520
- nearestItems.sort((aa, bb) => {
23521
- const distA = point3.getDistance(aa.getMbr().getCenter());
23522
- const distB = point3.getDistance(bb.getMbr().getCenter());
23523
- return distA - distB;
23524
- });
23525
- return nearestItems.slice(0, maxItems);
23519
+ const items = this.getItemsWithIncludedChildren(this.itemsArray);
23520
+ const filteredItems = filter ? items.filter(filter) : items;
23521
+ const itemsWithDistance = filteredItems.map((item) => ({
23522
+ item,
23523
+ distance: item.getMbr().getDistanceToPoint(point3)
23524
+ }));
23525
+ const inRange = itemsWithDistance.filter((x) => x.distance <= maxDistance);
23526
+ return inRange.sort((a, b) => a.distance - b.distance).slice(0, maxItems).map((x) => x.item);
23526
23527
  }
23527
23528
  list() {
23528
23529
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
@@ -24195,7 +24196,7 @@ class BaseItem extends Mbr {
24195
24196
  return this.getMbr().combine(this.index.getMbr());
24196
24197
  }
24197
24198
  getPath() {
24198
- return new Path(this.getMbr().getLines());
24199
+ return new Path(this.getMbr().getLines(), true);
24199
24200
  }
24200
24201
  render(context) {
24201
24202
  if (this.index) {
@@ -20890,13 +20890,14 @@ class SpatialIndex {
20890
20890
  return this.Mbr;
20891
20891
  }
20892
20892
  getNearestTo(point3, maxItems, filter, maxDistance) {
20893
- const nearestItems = this.itemsIndex.getNearestTo(point3, maxItems, filter, maxDistance);
20894
- nearestItems.sort((aa, bb) => {
20895
- const distA = point3.getDistance(aa.getMbr().getCenter());
20896
- const distB = point3.getDistance(bb.getMbr().getCenter());
20897
- return distA - distB;
20898
- });
20899
- return nearestItems.slice(0, maxItems);
20893
+ const items = this.getItemsWithIncludedChildren(this.itemsArray);
20894
+ const filteredItems = filter ? items.filter(filter) : items;
20895
+ const itemsWithDistance = filteredItems.map((item) => ({
20896
+ item,
20897
+ distance: item.getMbr().getDistanceToPoint(point3)
20898
+ }));
20899
+ const inRange = itemsWithDistance.filter((x) => x.distance <= maxDistance);
20900
+ return inRange.sort((a, b) => a.distance - b.distance).slice(0, maxItems).map((x) => x.item);
20900
20901
  }
20901
20902
  list() {
20902
20903
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
@@ -21569,7 +21570,7 @@ class BaseItem extends Mbr {
21569
21570
  return this.getMbr().combine(this.index.getMbr());
21570
21571
  }
21571
21572
  getPath() {
21572
- return new Path(this.getMbr().getLines());
21573
+ return new Path(this.getMbr().getLines(), true);
21573
21574
  }
21574
21575
  render(context) {
21575
21576
  if (this.index) {
package/dist/esm/index.js CHANGED
@@ -20883,13 +20883,14 @@ class SpatialIndex {
20883
20883
  return this.Mbr;
20884
20884
  }
20885
20885
  getNearestTo(point3, maxItems, filter, maxDistance) {
20886
- const nearestItems = this.itemsIndex.getNearestTo(point3, maxItems, filter, maxDistance);
20887
- nearestItems.sort((aa, bb) => {
20888
- const distA = point3.getDistance(aa.getMbr().getCenter());
20889
- const distB = point3.getDistance(bb.getMbr().getCenter());
20890
- return distA - distB;
20891
- });
20892
- return nearestItems.slice(0, maxItems);
20886
+ const items = this.getItemsWithIncludedChildren(this.itemsArray);
20887
+ const filteredItems = filter ? items.filter(filter) : items;
20888
+ const itemsWithDistance = filteredItems.map((item) => ({
20889
+ item,
20890
+ distance: item.getMbr().getDistanceToPoint(point3)
20891
+ }));
20892
+ const inRange = itemsWithDistance.filter((x) => x.distance <= maxDistance);
20893
+ return inRange.sort((a, b) => a.distance - b.distance).slice(0, maxItems).map((x) => x.item);
20893
20894
  }
20894
20895
  list() {
20895
20896
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
@@ -21562,7 +21563,7 @@ class BaseItem extends Mbr {
21562
21563
  return this.getMbr().combine(this.index.getMbr());
21563
21564
  }
21564
21565
  getPath() {
21565
- return new Path(this.getMbr().getLines());
21566
+ return new Path(this.getMbr().getLines(), true);
21566
21567
  }
21567
21568
  render(context) {
21568
21569
  if (this.index) {
package/dist/esm/node.js CHANGED
@@ -23350,13 +23350,14 @@ class SpatialIndex {
23350
23350
  return this.Mbr;
23351
23351
  }
23352
23352
  getNearestTo(point3, maxItems, filter, maxDistance) {
23353
- const nearestItems = this.itemsIndex.getNearestTo(point3, maxItems, filter, maxDistance);
23354
- nearestItems.sort((aa, bb) => {
23355
- const distA = point3.getDistance(aa.getMbr().getCenter());
23356
- const distB = point3.getDistance(bb.getMbr().getCenter());
23357
- return distA - distB;
23358
- });
23359
- return nearestItems.slice(0, maxItems);
23353
+ const items = this.getItemsWithIncludedChildren(this.itemsArray);
23354
+ const filteredItems = filter ? items.filter(filter) : items;
23355
+ const itemsWithDistance = filteredItems.map((item) => ({
23356
+ item,
23357
+ distance: item.getMbr().getDistanceToPoint(point3)
23358
+ }));
23359
+ const inRange = itemsWithDistance.filter((x) => x.distance <= maxDistance);
23360
+ return inRange.sort((a, b) => a.distance - b.distance).slice(0, maxItems).map((x) => x.item);
23360
23361
  }
23361
23362
  list() {
23362
23363
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
@@ -24029,7 +24030,7 @@ class BaseItem extends Mbr {
24029
24030
  return this.getMbr().combine(this.index.getMbr());
24030
24031
  }
24031
24032
  getPath() {
24032
- return new Path(this.getMbr().getLines());
24033
+ return new Path(this.getMbr().getLines(), true);
24033
24034
  }
24034
24035
  render(context) {
24035
24036
  if (this.index) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.36",
3
+ "version": "0.5.38",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",