@aibee/crc-bmap 0.0.62 → 0.0.64

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
  }
@@ -1949,6 +1966,7 @@ var Selection = class extends EventDispatcher4 {
1949
1966
  __publicField(this, "prevPanStatus");
1950
1967
  __publicField(this, "prevRotateStatus");
1951
1968
  __publicField(this, "downPoint", null);
1969
+ __publicField(this, "isMultipleSelect", false);
1952
1970
  __publicField(this, "onPointerDown", (e) => {
1953
1971
  this.downPoint = { x: e.offsetX, y: e.offsetY };
1954
1972
  });
@@ -1968,7 +1986,7 @@ var Selection = class extends EventDispatcher4 {
1968
1986
  var _a;
1969
1987
  if (!graphicIdSet.has(item.options.id)) {
1970
1988
  const graphic = ((_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.graphicMap.get(item.options.id)) || null;
1971
- if (graphic) {
1989
+ if (graphic && graphic.options.geometry.type === "point") {
1972
1990
  graphics.push(graphic);
1973
1991
  graphicIdSet.add(item.options.id);
1974
1992
  }
@@ -1983,6 +2001,7 @@ var Selection = class extends EventDispatcher4 {
1983
2001
  });
1984
2002
  __publicField(this, "onKeyDown", (e) => {
1985
2003
  if (e.key === "Control") {
2004
+ this.isMultipleSelect = true;
1986
2005
  this.boxSelection.setEnable(true);
1987
2006
  this.prevPanStatus = this.context.control.enablePan;
1988
2007
  this.prevRotateStatus = this.context.control.enableRotate;
@@ -1992,6 +2011,7 @@ var Selection = class extends EventDispatcher4 {
1992
2011
  });
1993
2012
  __publicField(this, "onKeyUp", (e) => {
1994
2013
  if (e.key === "Control") {
2014
+ this.isMultipleSelect = false;
1995
2015
  this.boxSelection.setEnable(false);
1996
2016
  this.context.control.enablePan = !!this.prevPanStatus;
1997
2017
  this.context.control.enableRotate = !!this.prevRotateStatus;
@@ -2012,7 +2032,7 @@ var Selection = class extends EventDispatcher4 {
2012
2032
  return this._list;
2013
2033
  }
2014
2034
  selectEnd() {
2015
- this.dispatchEvent({ type: "select", graphics: [...this._list] });
2035
+ this.dispatchEvent({ type: "select", graphics: [...this._list], isMultipleSelect: this.isMultipleSelect });
2016
2036
  }
2017
2037
  registryEvent() {
2018
2038
  this.context.container.addEventListener("pointerdown", this.onPointerDown);
@@ -2052,14 +2072,19 @@ var HoverHelper = class extends EventDispatcher5 {
2052
2072
  const poiGraphics = pois.map((item) => {
2053
2073
  var _a;
2054
2074
  return (_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.graphicMap.get(item.options.id);
2055
- });
2075
+ }).filter((graphic) => graphic && graphic.options.geometry.type === "point");
2056
2076
  if (!graphics.length && !poiGraphics && this.curGraphics.size) {
2057
2077
  this.curGraphics.clear();
2058
2078
  this.handleHoverGraphicsChange();
2059
2079
  return;
2060
2080
  }
2061
2081
  const { time } = this.context.config.hover;
2062
- const allGraphics = /* @__PURE__ */ new Set([...graphics, ...poiGraphics]);
2082
+ const allGraphics = new Set(graphics);
2083
+ if (!allGraphics.size) {
2084
+ poiGraphics.forEach((graphic) => {
2085
+ allGraphics.add(graphic);
2086
+ });
2087
+ }
2063
2088
  allGraphics.forEach((graphic) => {
2064
2089
  if (this.graphicTimerMap.get(graphic)) {
2065
2090
  return;
@@ -2227,8 +2252,8 @@ var Context = class extends EventDispatcher6 {
2227
2252
  __publicField(this, "onPointerleave", () => {
2228
2253
  this.dispatchEvent({ type: "pointer-level" });
2229
2254
  });
2230
- __publicField(this, "onSelectionSelect", ({ graphics }) => {
2231
- this.dispatchEvent({ type: "select-graphic", graphics });
2255
+ __publicField(this, "onSelectionSelect", ({ graphics, isMultipleSelect }) => {
2256
+ this.dispatchEvent({ type: "select-graphic", graphics, isMultipleSelect });
2232
2257
  });
2233
2258
  __publicField(this, "onHoverChange", ({ graphics }) => {
2234
2259
  this.dispatchEvent({ type: "hover", graphics });
@@ -2550,6 +2575,7 @@ var defaultConfig = {
2550
2575
  floorRange: "/api/inception-map/range/get"
2551
2576
  },
2552
2577
  resizeObserver: false,
2578
+ initTransToMark: false,
2553
2579
  heatMap: {
2554
2580
  radius: 50,
2555
2581
  gradient: {
@@ -2580,7 +2606,7 @@ var defaultConfig = {
2580
2606
  time: 100
2581
2607
  },
2582
2608
  ground: {
2583
- color: "#ffffff",
2609
+ color: "#FAFAFA",
2584
2610
  opacity: 1,
2585
2611
  height: 3,
2586
2612
  stroke: true,
@@ -2588,7 +2614,7 @@ var defaultConfig = {
2588
2614
  strokeOpacity: 1
2589
2615
  },
2590
2616
  markGraphic: {
2591
- color: "#ecf0f7",
2617
+ color: "#EEF0F3",
2592
2618
  opacity: 1,
2593
2619
  height: 1e-3,
2594
2620
  stroke: false,
@@ -2768,6 +2794,13 @@ var BMap = class extends EventDispatcher7 {
2768
2794
  item.info.strokeOpacity = markGraphic.strokeOpacity;
2769
2795
  } else {
2770
2796
  item.info.fillOpacity = graphic.fillOpacity;
2797
+ if (this.config.initTransToMark) {
2798
+ item.info.height = markGraphic.height;
2799
+ item.info.fillColor = markGraphic.color;
2800
+ item.info.stroke = markGraphic.stroke;
2801
+ item.info.strokeColor = markGraphic.strokeColor;
2802
+ item.info.strokeOpacity = markGraphic.strokeOpacity;
2803
+ }
2771
2804
  }
2772
2805
  }
2773
2806
  if (!this.config.useFloorCache) {
@@ -3069,7 +3102,6 @@ var BMap = class extends EventDispatcher7 {
3069
3102
  }
3070
3103
  clearPoi() {
3071
3104
  if (this.context.currentFloor) {
3072
- this.getPois().forEach((poi) => poi.dispose());
3073
3105
  this.context.currentFloor.poiLayer.clear();
3074
3106
  }
3075
3107
  }