@aibee/crc-bmap 0.0.84 → 0.0.86

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
@@ -2801,17 +2801,25 @@ var Context = class extends EventDispatcher6 {
2801
2801
  const boundingBox = new Box38().setFromObject(object);
2802
2802
  this.setPolarAngle(polar, 0);
2803
2803
  const { max, min } = boundingBox;
2804
- const max2d = vector3ToDevice(max, this.camera, width, height);
2805
- const min2d = vector3ToDevice(min, this.camera, width, height);
2804
+ const leftTop = new Vector312(min.x, max.y, min.z);
2805
+ const rightTop = new Vector312(max.x, max.y, min.z);
2806
+ const rightBottom = new Vector312(max.x, min.y, max.z);
2807
+ const leftBottom = new Vector312(min.x, min.y, max.z);
2808
+ const leftTop2d = vector3ToDevice(leftTop, this.camera, width, height);
2809
+ const rightTop2d = vector3ToDevice(rightTop, this.camera, width, height);
2810
+ const leftBottom2d = vector3ToDevice(leftBottom, this.camera, width, height);
2811
+ const rightBottom2d = vector3ToDevice(rightBottom, this.camera, width, height);
2806
2812
  const boundingBox2d = new Box2().setFromPoints([
2807
- new Vector23(max2d.x, max2d.y),
2808
- new Vector23(min2d.x, min2d.y)
2813
+ new Vector23(leftTop2d.x, leftTop2d.y),
2814
+ new Vector23(rightTop2d.x, rightTop2d.y),
2815
+ new Vector23(leftBottom2d.x, leftBottom2d.y),
2816
+ new Vector23(rightBottom2d.x, rightBottom2d.y)
2809
2817
  ]);
2810
2818
  const size = boundingBox2d.getSize(new Vector23());
2811
2819
  const xScale = (width - right - left) / size.x;
2812
2820
  const yScale = (height - top - bottom) / size.y;
2813
2821
  const scale = Math.min(xScale, yScale);
2814
- const center2 = new Vector312((max.x + min.x) / 2, (max.y + min.y) / 2, max.z);
2822
+ const center2 = new Vector312((max.x + min.x) / 2, (max.y + min.y) / 2, 0);
2815
2823
  return { zoom: scale * this.camera.zoom, center: center2 };
2816
2824
  }
2817
2825
  /**
@@ -2913,8 +2921,10 @@ var defaultConfig = {
2913
2921
  useFloorCache: true,
2914
2922
  control: {
2915
2923
  maxPolar: 1.2,
2916
- defaultPolar: 0.9
2924
+ defaultPolar: 1.1,
2925
+ defaultAzimuthal: 0
2917
2926
  },
2927
+ defaultPadding: [20, 20, 20, 20],
2918
2928
  svg: {
2919
2929
  circle: {
2920
2930
  radius: "2",
@@ -2965,7 +2975,7 @@ function getConfig(config) {
2965
2975
  import { debounce as debounce2 } from "lodash";
2966
2976
  var MapTypePolar = /* @__PURE__ */ ((MapTypePolar2) => {
2967
2977
  MapTypePolar2[MapTypePolar2["D2"] = 0] = "D2";
2968
- MapTypePolar2[MapTypePolar2["D3"] = 0.9] = "D3";
2978
+ MapTypePolar2[MapTypePolar2["D3"] = 1.1] = "D3";
2969
2979
  return MapTypePolar2;
2970
2980
  })(MapTypePolar || {});
2971
2981
  var BMap = class extends EventDispatcher7 {
@@ -3179,14 +3189,14 @@ var BMap = class extends EventDispatcher7 {
3179
3189
  this.context.control.minZoom = 0;
3180
3190
  this.context.control.maxZoom = Infinity;
3181
3191
  this.context.camera.zoom = 1;
3182
- this.context.setAzimuthalAngle(0, 0);
3192
+ this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal, 0);
3183
3193
  this.context.fitCameraToGround(void 0, 0);
3184
3194
  this.basicZoom = this.context.camera.zoom;
3185
3195
  this.context.control.minZoom = this.basicZoom;
3186
3196
  this.context.control.maxZoom = this.basicZoom * 25;
3187
3197
  this.context.control.addEventListener("change", this.onControlChange);
3188
3198
  if (this.type === "3d") {
3189
- this.context.fitCameraToGround([20, 20, 20, 20], 0, false);
3199
+ this.context.fitCameraToGround(this.config.defaultPadding, 0, false);
3190
3200
  }
3191
3201
  this.onControlChange();
3192
3202
  this.context.cameraBound.setEnable(true);
@@ -3290,15 +3300,15 @@ var BMap = class extends EventDispatcher7 {
3290
3300
  if (type === "2d") {
3291
3301
  return this.context.setPolarAngle(0 /* D2 */, duration);
3292
3302
  } else {
3293
- return this.context.setPolarAngle(0.9 /* D3 */, duration);
3303
+ return this.context.setPolarAngle(1.1 /* D3 */, duration);
3294
3304
  }
3295
3305
  }
3296
3306
  resetView(duration = 300) {
3297
3307
  return __async(this, null, function* () {
3298
3308
  const time = duration / 3;
3299
- yield this.context.setAzimuthalAngle(0, time);
3309
+ yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal, time);
3300
3310
  yield this.changeMapType(this.type, time);
3301
- yield this.context.fitCameraToGround(void 0, time);
3311
+ yield this.context.fitCameraToGround(this.config.defaultPadding, time, false);
3302
3312
  });
3303
3313
  }
3304
3314
  /**