@aibee/crc-bmap 0.0.64 → 0.0.65

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
@@ -2485,11 +2485,13 @@ var Context = class extends EventDispatcher6 {
2485
2485
  * @param duration
2486
2486
  * @returns
2487
2487
  */
2488
- fitCameraToObject(object, padding = [20, 20, 20, 20], duration = 500) {
2488
+ fitCameraToObject(object, padding = [20, 20, 20, 20], duration = 500, force2DView = true) {
2489
2489
  const [top, right, bottom, left] = padding;
2490
2490
  const { clientSize: { width, height } } = this;
2491
2491
  const polar = this.control.getPolarAngle();
2492
- this.setPolarAngle(0, 0);
2492
+ if (force2DView) {
2493
+ this.setPolarAngle(0, 0);
2494
+ }
2493
2495
  const boundingBox = new Box36().setFromObject(object);
2494
2496
  this.setPolarAngle(polar, 0);
2495
2497
  const { max, min } = boundingBox;
@@ -2506,9 +2508,9 @@ var Context = class extends EventDispatcher6 {
2506
2508
  const center2 = new Vector39((max.x + min.x) / 2, (max.y + min.y) / 2, max.z);
2507
2509
  return this.setZoom(scale * this.camera.zoom, center2, duration);
2508
2510
  }
2509
- fitCameraToGround(padding = [20, 20, 20, 20], duration = 500) {
2511
+ fitCameraToGround(padding = [20, 20, 20, 20], duration = 500, force2DView = true) {
2510
2512
  if (this.currentFloor && this.currentFloor.hasElement) {
2511
- return this.fitCameraToObject(this.currentFloor.groundUpper, padding, duration);
2513
+ return this.fitCameraToObject(this.currentFloor.groundUpper, padding, duration, force2DView);
2512
2514
  } else {
2513
2515
  return Promise.resolve(false);
2514
2516
  }
@@ -2850,6 +2852,9 @@ var BMap = class extends EventDispatcher7 {
2850
2852
  this.context.control.minZoom = this.basicZoom;
2851
2853
  this.context.control.maxZoom = this.basicZoom * 25;
2852
2854
  this.context.control.addEventListener("change", this.onControlChange);
2855
+ if (this.type === "3d") {
2856
+ this.context.fitCameraToGround([80, 20, 80, 20], 0, false);
2857
+ }
2853
2858
  this.onControlChange();
2854
2859
  } else {
2855
2860
  console.warn("[switchFloor error] [" + floor + "] \u697C\u5C42\u6CA1\u6709\u6570\u636E");