@aibee/crc-bmap 0.0.62 → 0.0.63

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/lib/bmap.esm.js CHANGED
@@ -835,14 +835,17 @@ var Poi = class extends EventDispatcher2 {
835
835
  __publicField(this, "img");
836
836
  __publicField(this, "overlay");
837
837
  __publicField(this, "options");
838
+ __publicField(this, "visible", true);
838
839
  __publicField(this, "size", { width: 0, height: 0 });
839
840
  __publicField(this, "position", new Vector34());
840
841
  __publicField(this, "_changePosition", () => {
841
- this.div.style.transform = `translate3d(-50%, ${this.options.icon ? "-100%" : "-50%"}, 0)`;
842
842
  });
843
843
  this.options = proxyOptions(__spreadValues(__spreadValues({}, defaultOptions3), options), this);
844
844
  this.position.set(((_a = options.position) == null ? void 0 : _a.x) || 0, ((_b = options.position) == null ? void 0 : _b.y) || 0, ((_c = options.position) == null ? void 0 : _c.z) || 0);
845
- this.overlay = new Overlay(this.context);
845
+ this.overlay = new Overlay(this.context, { autoUpdate: false });
846
+ this.overlay.addEventListener("update-position", ({ x, y, height }) => {
847
+ this.overlay.div.style.transform = `translate3d(calc(${x}px - 50%), calc(${-height + y}px - ${this.options.icon ? "100%" : "50%"}), 0)`;
848
+ });
846
849
  this.overlay.bindElement(this);
847
850
  this.registryEvent();
848
851
  this.initDiv();
@@ -982,6 +985,19 @@ var Poi = class extends EventDispatcher2 {
982
985
  unRegistryEvent() {
983
986
  }
984
987
  setVisible(visible) {
988
+ if (visible === this.visible) {
989
+ return;
990
+ }
991
+ this.visible = visible;
992
+ if (!visible) {
993
+ this.overlay.visible = visible;
994
+ this.overlay.div.style.visibility = visible ? "visible" : "hidden";
995
+ }
996
+ }
997
+ parentSetVisible(visible) {
998
+ if (!this.visible) {
999
+ return;
1000
+ }
985
1001
  if (visible === this.overlay.visible) {
986
1002
  return;
987
1003
  }
@@ -1111,6 +1127,7 @@ var PoiLayer = class extends Layer {
1111
1127
  }
1112
1128
  clear() {
1113
1129
  super.clear();
1130
+ this.pois.forEach((item) => item.dispose());
1114
1131
  this.pois = [];
1115
1132
  return this;
1116
1133
  }
@@ -1186,7 +1203,7 @@ var PoiLayer = class extends Layer {
1186
1203
  */
1187
1204
  collisionDetection() {
1188
1205
  const range = [];
1189
- const pois = this.pois.filter((item) => item.withinDisplayRange);
1206
+ const pois = this.pois.filter((item) => item.visible && item.withinDisplayRange);
1190
1207
  pois.forEach((item, index) => {
1191
1208
  const { left, right, top, bottom } = item.getBox();
1192
1209
  if (index === 0) {
@@ -1201,7 +1218,7 @@ var PoiLayer = class extends Layer {
1201
1218
  }
1202
1219
  return false;
1203
1220
  });
1204
- item.setVisible(!valid);
1221
+ item.parentSetVisible(!valid);
1205
1222
  if (!valid) {
1206
1223
  range.push({ left, right, top, bottom });
1207
1224
  }
@@ -2550,6 +2567,7 @@ var defaultConfig = {
2550
2567
  floorRange: "/api/inception-map/range/get"
2551
2568
  },
2552
2569
  resizeObserver: false,
2570
+ initTransToMark: false,
2553
2571
  heatMap: {
2554
2572
  radius: 50,
2555
2573
  gradient: {
@@ -2580,7 +2598,7 @@ var defaultConfig = {
2580
2598
  time: 100
2581
2599
  },
2582
2600
  ground: {
2583
- color: "#ffffff",
2601
+ color: "#FAFAFA",
2584
2602
  opacity: 1,
2585
2603
  height: 3,
2586
2604
  stroke: true,
@@ -2588,7 +2606,7 @@ var defaultConfig = {
2588
2606
  strokeOpacity: 1
2589
2607
  },
2590
2608
  markGraphic: {
2591
- color: "#ecf0f7",
2609
+ color: "#EEF0F3",
2592
2610
  opacity: 1,
2593
2611
  height: 1e-3,
2594
2612
  stroke: false,
@@ -2768,6 +2786,13 @@ var BMap = class extends EventDispatcher7 {
2768
2786
  item.info.strokeOpacity = markGraphic.strokeOpacity;
2769
2787
  } else {
2770
2788
  item.info.fillOpacity = graphic.fillOpacity;
2789
+ if (this.config.initTransToMark) {
2790
+ item.info.height = markGraphic.height;
2791
+ item.info.fillColor = markGraphic.color;
2792
+ item.info.stroke = markGraphic.stroke;
2793
+ item.info.strokeColor = markGraphic.strokeColor;
2794
+ item.info.strokeOpacity = markGraphic.strokeOpacity;
2795
+ }
2771
2796
  }
2772
2797
  }
2773
2798
  if (!this.config.useFloorCache) {
@@ -3069,7 +3094,6 @@ var BMap = class extends EventDispatcher7 {
3069
3094
  }
3070
3095
  clearPoi() {
3071
3096
  if (this.context.currentFloor) {
3072
- this.getPois().forEach((poi) => poi.dispose());
3073
3097
  this.context.currentFloor.poiLayer.clear();
3074
3098
  }
3075
3099
  }