@aibee/crc-bmap 0.0.31 → 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;
@@ -2289,9 +2302,21 @@ var BMap = class extends EventDispatcher6 {
2289
2302
  __publicField(this, "svgLine");
2290
2303
  __publicField(this, "svgPolygon");
2291
2304
  __publicField(this, "basicZoom", 1);
2305
+ __publicField(this, "prevCameraZoom", 1);
2292
2306
  __publicField(this, "floorDataMap", /* @__PURE__ */ new Map());
2293
2307
  __publicField(this, "buildingGroundMap", /* @__PURE__ */ new Map());
2294
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
+ });
2295
2320
  __publicField(this, "onKeydown", (e) => {
2296
2321
  if (this.polarKeys.includes(e.code)) {
2297
2322
  this.context.control.maxPolarAngle = this.config.control.maxPolar;
@@ -2417,6 +2442,7 @@ var BMap = class extends EventDispatcher6 {
2417
2442
  return __async(this, arguments, function* ({ brand, project, phase, building, floor, ts, resource_type_list }) {
2418
2443
  const floorKey = this.getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list });
2419
2444
  const curFloorData = this.floorDataMap.get(floorKey);
2445
+ this.context.control.removeEventListener("change", this.onControlChange);
2420
2446
  if (curFloorData) {
2421
2447
  const buildingKey = this.getBuildingKey({ brand, project, phase, building });
2422
2448
  this.currentBuildGround = this.buildingGroundMap.get(buildingKey) || null;
@@ -2429,6 +2455,8 @@ var BMap = class extends EventDispatcher6 {
2429
2455
  this.basicZoom = this.context.camera.zoom;
2430
2456
  this.context.control.minZoom = this.basicZoom;
2431
2457
  this.context.control.maxZoom = this.basicZoom * 25;
2458
+ this.context.control.addEventListener("change", this.onControlChange);
2459
+ this.onControlChange();
2432
2460
  } else {
2433
2461
  console.warn("[switchFloor error] [" + floor + "] \u697C\u5C42\u6CA1\u6709\u6570\u636E");
2434
2462
  }
@@ -2729,6 +2757,7 @@ export {
2729
2757
  setCirclePosition,
2730
2758
  setLineStartEnd,
2731
2759
  setRectPosition,
2760
+ sleepOnePromise,
2732
2761
  timeoutPromise,
2733
2762
  vector3ToDevice
2734
2763
  };