@aibee/crc-bmap 0.0.42 → 0.0.45

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