@aibee/crc-bmap 0.0.30 → 0.0.32

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
@@ -368,6 +368,11 @@ function setRectPosition(rect, x, y, w, h) {
368
368
  rect.setAttribute("height", `${h}`);
369
369
  }
370
370
 
371
+ // src/utils/sleep.ts
372
+ function sleepOnePromise() {
373
+ return Promise.resolve();
374
+ }
375
+
371
376
  // src/context.ts
372
377
  import {
373
378
  EventDispatcher as EventDispatcher5,
@@ -769,12 +774,20 @@ var Poi = class extends Object3D4 {
769
774
  });
770
775
  }
771
776
  resetSize() {
772
- const { width, height } = this.overlay.div.getBoundingClientRect();
773
- this.size = {
774
- width,
775
- height
776
- };
777
- this._changePosition();
777
+ return __async(this, null, function* () {
778
+ const visible = this.overlay.visible;
779
+ this.setVisible(true);
780
+ yield sleepOnePromise();
781
+ const { width, height } = this.overlay.div.getBoundingClientRect();
782
+ console.log(width, height);
783
+ this.size = {
784
+ width,
785
+ height
786
+ };
787
+ this._changePosition();
788
+ yield sleepOnePromise();
789
+ this.setVisible(visible);
790
+ });
778
791
  }
779
792
  get clientPos() {
780
793
  return this.overlay.clientPos;
@@ -1838,6 +1851,12 @@ var Selection = class extends EventDispatcher3 {
1838
1851
  window.removeEventListener("keyup", this.onKeyUp);
1839
1852
  this.boxSelection.removeEventListener("selected", this.onBoxSelected);
1840
1853
  }
1854
+ clear() {
1855
+ this._list.clear();
1856
+ }
1857
+ remove(graphic) {
1858
+ this._list.delete(graphic);
1859
+ }
1841
1860
  dispose() {
1842
1861
  this.unRegistryEvent();
1843
1862
  }
@@ -2283,9 +2302,21 @@ var BMap = class extends EventDispatcher6 {
2283
2302
  __publicField(this, "svgLine");
2284
2303
  __publicField(this, "svgPolygon");
2285
2304
  __publicField(this, "basicZoom", 1);
2305
+ __publicField(this, "prevCameraZoom", 1);
2286
2306
  __publicField(this, "floorDataMap", /* @__PURE__ */ new Map());
2287
2307
  __publicField(this, "buildingGroundMap", /* @__PURE__ */ new Map());
2288
2308
  __publicField(this, "currentBuildGround", null);
2309
+ __publicField(this, "onControlChange", () => {
2310
+ const { camera: { zoom } } = this.context;
2311
+ if (zoom !== this.prevCameraZoom) {
2312
+ this.dispatchEvent({
2313
+ type: "zoom-change",
2314
+ basicZoom: this.basicZoom,
2315
+ cameraZoom: this.context.camera.zoom
2316
+ });
2317
+ this.prevCameraZoom = zoom;
2318
+ }
2319
+ });
2289
2320
  __publicField(this, "onKeydown", (e) => {
2290
2321
  if (this.polarKeys.includes(e.code)) {
2291
2322
  this.context.control.maxPolarAngle = this.config.control.maxPolar;
@@ -2411,6 +2442,7 @@ var BMap = class extends EventDispatcher6 {
2411
2442
  return __async(this, arguments, function* ({ brand, project, phase, building, floor, ts, resource_type_list }) {
2412
2443
  const floorKey = this.getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list });
2413
2444
  const curFloorData = this.floorDataMap.get(floorKey);
2445
+ this.context.control.removeEventListener("change", this.onControlChange);
2414
2446
  if (curFloorData) {
2415
2447
  const buildingKey = this.getBuildingKey({ brand, project, phase, building });
2416
2448
  this.currentBuildGround = this.buildingGroundMap.get(buildingKey) || null;
@@ -2423,6 +2455,8 @@ var BMap = class extends EventDispatcher6 {
2423
2455
  this.basicZoom = this.context.camera.zoom;
2424
2456
  this.context.control.minZoom = this.basicZoom;
2425
2457
  this.context.control.maxZoom = this.basicZoom * 25;
2458
+ this.context.control.addEventListener("change", this.onControlChange);
2459
+ this.onControlChange();
2426
2460
  } else {
2427
2461
  console.warn("[switchFloor error] [" + floor + "] \u697C\u5C42\u6CA1\u6709\u6570\u636E");
2428
2462
  }
@@ -2667,6 +2701,9 @@ var BMap = class extends EventDispatcher6 {
2667
2701
  this.context.currentFloor.poiLayer.clear();
2668
2702
  }
2669
2703
  }
2704
+ removeSelectGraphic(graphic) {
2705
+ this.context.selection.remove(graphic);
2706
+ }
2670
2707
  dispose() {
2671
2708
  this.context.dispose();
2672
2709
  clearTextTexture();
@@ -2720,6 +2757,7 @@ export {
2720
2757
  setCirclePosition,
2721
2758
  setLineStartEnd,
2722
2759
  setRectPosition,
2760
+ sleepOnePromise,
2723
2761
  timeoutPromise,
2724
2762
  vector3ToDevice
2725
2763
  };