@aibee/crc-bmap 0.0.61 → 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();
@@ -940,8 +943,7 @@ var Poi = class extends EventDispatcher2 {
940
943
  initText() {
941
944
  const textDiv = document.createElement("div");
942
945
  textDiv.appendChild(this.createTextFragment());
943
- if (this.options.texts.length > 1) {
944
- }
946
+ textDiv.style.textAlign = "center";
945
947
  this.textDiv = textDiv;
946
948
  return textDiv;
947
949
  }
@@ -983,6 +985,19 @@ var Poi = class extends EventDispatcher2 {
983
985
  unRegistryEvent() {
984
986
  }
985
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
+ }
986
1001
  if (visible === this.overlay.visible) {
987
1002
  return;
988
1003
  }
@@ -1112,6 +1127,7 @@ var PoiLayer = class extends Layer {
1112
1127
  }
1113
1128
  clear() {
1114
1129
  super.clear();
1130
+ this.pois.forEach((item) => item.dispose());
1115
1131
  this.pois = [];
1116
1132
  return this;
1117
1133
  }
@@ -1187,7 +1203,7 @@ var PoiLayer = class extends Layer {
1187
1203
  */
1188
1204
  collisionDetection() {
1189
1205
  const range = [];
1190
- const pois = this.pois.filter((item) => item.withinDisplayRange);
1206
+ const pois = this.pois.filter((item) => item.visible && item.withinDisplayRange);
1191
1207
  pois.forEach((item, index) => {
1192
1208
  const { left, right, top, bottom } = item.getBox();
1193
1209
  if (index === 0) {
@@ -1202,7 +1218,7 @@ var PoiLayer = class extends Layer {
1202
1218
  }
1203
1219
  return false;
1204
1220
  });
1205
- item.setVisible(!valid);
1221
+ item.parentSetVisible(!valid);
1206
1222
  if (!valid) {
1207
1223
  range.push({ left, right, top, bottom });
1208
1224
  }
@@ -2551,6 +2567,7 @@ var defaultConfig = {
2551
2567
  floorRange: "/api/inception-map/range/get"
2552
2568
  },
2553
2569
  resizeObserver: false,
2570
+ initTransToMark: false,
2554
2571
  heatMap: {
2555
2572
  radius: 50,
2556
2573
  gradient: {
@@ -2581,7 +2598,7 @@ var defaultConfig = {
2581
2598
  time: 100
2582
2599
  },
2583
2600
  ground: {
2584
- color: "#ffffff",
2601
+ color: "#FAFAFA",
2585
2602
  opacity: 1,
2586
2603
  height: 3,
2587
2604
  stroke: true,
@@ -2589,7 +2606,7 @@ var defaultConfig = {
2589
2606
  strokeOpacity: 1
2590
2607
  },
2591
2608
  markGraphic: {
2592
- color: "#ecf0f7",
2609
+ color: "#EEF0F3",
2593
2610
  opacity: 1,
2594
2611
  height: 1e-3,
2595
2612
  stroke: false,
@@ -2769,6 +2786,13 @@ var BMap = class extends EventDispatcher7 {
2769
2786
  item.info.strokeOpacity = markGraphic.strokeOpacity;
2770
2787
  } else {
2771
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
+ }
2772
2796
  }
2773
2797
  }
2774
2798
  if (!this.config.useFloorCache) {
@@ -3070,7 +3094,6 @@ var BMap = class extends EventDispatcher7 {
3070
3094
  }
3071
3095
  clearPoi() {
3072
3096
  if (this.context.currentFloor) {
3073
- this.getPois().forEach((poi) => poi.dispose());
3074
3097
  this.context.currentFloor.poiLayer.clear();
3075
3098
  }
3076
3099
  }