@aibee/crc-bmap 0.0.42 → 0.0.43

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
@@ -1921,14 +1921,19 @@ var HoverHelper = class extends EventDispatcher4 {
1921
1921
  __publicField(this, "curGraphics", /* @__PURE__ */ new Set());
1922
1922
  __publicField(this, "timer", new Timer());
1923
1923
  __publicField(this, "graphicTimerMap", /* @__PURE__ */ new Map());
1924
- __publicField(this, "onPointerMove", ({ graphics }) => {
1925
- if (!graphics.length && this.curGraphics.size) {
1924
+ __publicField(this, "onPointerMove", ({ graphics, pois }) => {
1925
+ const poiGraphics = pois.map((item) => {
1926
+ var _a;
1927
+ return (_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.graphicMap.get(item.options.id);
1928
+ });
1929
+ if (!graphics.length && !poiGraphics && this.curGraphics.size) {
1926
1930
  this.curGraphics.clear();
1927
1931
  this.handleHoverGraphicsChange();
1928
1932
  return;
1929
1933
  }
1930
1934
  const { time } = this.context.config.hover;
1931
- graphics.forEach((graphic) => {
1935
+ const allGraphics = /* @__PURE__ */ new Set([...graphics, ...poiGraphics]);
1936
+ allGraphics.forEach((graphic) => {
1932
1937
  if (this.graphicTimerMap.get(graphic)) {
1933
1938
  return;
1934
1939
  }
@@ -1942,14 +1947,14 @@ var HoverHelper = class extends EventDispatcher4 {
1942
1947
  this.graphicTimerMap.set(graphic, timer);
1943
1948
  });
1944
1949
  this.graphicTimerMap.forEach((timer, graphic) => {
1945
- if (!graphics.includes(graphic)) {
1950
+ if (!allGraphics.has(graphic)) {
1946
1951
  this.timer.clearTimeout(timer);
1947
1952
  this.graphicTimerMap.delete(graphic);
1948
1953
  }
1949
1954
  });
1950
1955
  const size = this.curGraphics.size;
1951
1956
  this.curGraphics.forEach((graphic) => {
1952
- if (!graphics.includes(graphic)) {
1957
+ if (!allGraphics.has(graphic)) {
1953
1958
  this.curGraphics.delete(graphic);
1954
1959
  }
1955
1960
  });
@@ -1964,7 +1969,7 @@ var HoverHelper = class extends EventDispatcher4 {
1964
1969
  this.registryEvent();
1965
1970
  }
1966
1971
  handleHoverGraphicsChange(graphics = this.curGraphics) {
1967
- this.dispatchEvent({ type: "hover-change", graphics: Array.from(this.curGraphics) });
1972
+ this.dispatchEvent({ type: "hover-change", graphics: Array.from(graphics) });
1968
1973
  }
1969
1974
  registryEvent() {
1970
1975
  this.context.addEventListener("pointer-over", this.onPointerMove);
@@ -2199,7 +2204,6 @@ var Context = class extends EventDispatcher5 {
2199
2204
  this.control.update();
2200
2205
  this.control.maxAzimuthAngle = Infinity;
2201
2206
  this.control.minAzimuthAngle = Infinity;
2202
- return Promise.resolve();
2203
2207
  }
2204
2208
  return timeoutPromise(
2205
2209
  new Promise((resolve) => {
@@ -2232,13 +2236,18 @@ var Context = class extends EventDispatcher5 {
2232
2236
  * @returns
2233
2237
  */
2234
2238
  setZoom(zoom, center2, duration = 500) {
2239
+ const lookAtVector = this.getCameraLookAt();
2240
+ const start = {
2241
+ zoom: this.camera.zoom,
2242
+ target: this.control.target.clone()
2243
+ };
2244
+ if (!duration) {
2245
+ this.camera.position.copy(start.target.clone().sub(lookAtVector));
2246
+ this.control.target.copy(start.target);
2247
+ this.camera.zoom = start.zoom;
2248
+ }
2235
2249
  return timeoutPromise(
2236
2250
  new Promise((resolve) => {
2237
- const start = {
2238
- zoom: this.camera.zoom,
2239
- target: this.control.target.clone()
2240
- };
2241
- const lookAtVector = this.getCameraLookAt();
2242
2251
  const tween = new Tween(start, this.tweenGroup).to(
2243
2252
  {
2244
2253
  zoom,
@@ -2550,33 +2559,31 @@ var BMap = class extends EventDispatcher6 {
2550
2559
  curFloor.userData.legacyToGraphicMap = legacyToGraphicMap;
2551
2560
  return { curFloor, graphics };
2552
2561
  }
2553
- switchFloor(_0) {
2554
- return __async(this, arguments, function* ({ brand, project, phase, building, floor, ts, resource_type_list }) {
2555
- const floorKey = this.getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list });
2556
- const curFloorData = this.floorDataMap.get(floorKey);
2557
- this.context.control.removeEventListener("change", this.onControlChange);
2558
- if (curFloorData) {
2559
- const buildingKey = this.getBuildingKey({ brand, project, phase, building });
2560
- this.currentBuildGround = this.buildingGroundMap.get(buildingKey) || null;
2561
- const createdFloor = this.createFloor(curFloorData);
2562
- if (createdFloor) {
2563
- this.context.switchFloor(createdFloor.curFloor);
2564
- this.context.control.minZoom = 0;
2565
- this.context.control.maxZoom = Infinity;
2566
- yield this.context.setAzimuthalAngle(0, 0);
2567
- yield this.context.fitCameraToGround(void 0, 0);
2568
- this.basicZoom = this.context.camera.zoom;
2569
- this.context.control.minZoom = this.basicZoom;
2570
- this.context.control.maxZoom = this.basicZoom * 25;
2571
- this.context.control.addEventListener("change", this.onControlChange);
2572
- this.onControlChange();
2573
- } else {
2574
- console.warn("[switchFloor error] [" + floor + "] \u697C\u5C42\u6CA1\u6709\u6570\u636E");
2575
- }
2562
+ switchFloor({ brand, project, phase, building, floor, ts, resource_type_list }) {
2563
+ const floorKey = this.getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list });
2564
+ const curFloorData = this.floorDataMap.get(floorKey);
2565
+ this.context.control.removeEventListener("change", this.onControlChange);
2566
+ if (curFloorData) {
2567
+ const buildingKey = this.getBuildingKey({ brand, project, phase, building });
2568
+ this.currentBuildGround = this.buildingGroundMap.get(buildingKey) || null;
2569
+ const createdFloor = this.createFloor(curFloorData);
2570
+ if (createdFloor) {
2571
+ this.context.switchFloor(createdFloor.curFloor);
2572
+ this.context.control.minZoom = 0;
2573
+ this.context.control.maxZoom = Infinity;
2574
+ this.context.setAzimuthalAngle(0, 0);
2575
+ this.context.fitCameraToGround(void 0, 0);
2576
+ this.basicZoom = this.context.camera.zoom;
2577
+ this.context.control.minZoom = this.basicZoom;
2578
+ this.context.control.maxZoom = this.basicZoom * 25;
2579
+ this.context.control.addEventListener("change", this.onControlChange);
2580
+ this.onControlChange();
2576
2581
  } else {
2577
- console.warn("[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42");
2582
+ console.warn("[switchFloor error] [" + floor + "] \u697C\u5C42\u6CA1\u6709\u6570\u636E");
2578
2583
  }
2579
- });
2584
+ } else {
2585
+ console.warn("[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42");
2586
+ }
2580
2587
  }
2581
2588
  addHeatmap(data) {
2582
2589
  var _a;