@aibee/crc-bmap 0.0.67 → 0.0.68

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
@@ -2312,8 +2312,8 @@ var CameraBound = class {
2312
2312
  __publicField(this, "onCameraChange", () => {
2313
2313
  const bound = this.getCurFloorScreenPosition();
2314
2314
  if (bound) {
2315
- const { leftBottom, rightTop } = bound;
2316
- const isInBound = this.checkDistanceToScreenEdge(leftBottom, rightTop);
2315
+ const { left, right, top, bottom } = bound;
2316
+ const isInBound = this.checkDistanceToScreenEdge({ left, right, top, bottom });
2317
2317
  if (isInBound) {
2318
2318
  this.changePrevCamera();
2319
2319
  } else {
@@ -2360,24 +2360,25 @@ var CameraBound = class {
2360
2360
  const box = new Box37().setFromObject(this.context.currentFloor.groundUpper);
2361
2361
  const { camera, container: { clientWidth: w, clientHeight: h } } = this.context;
2362
2362
  const { min, max } = box;
2363
- const leftBottom = vector3ToDevice(min, camera, w, h);
2364
- const rightTop = vector3ToDevice(max, camera, w, h);
2365
- return { leftBottom, rightTop };
2363
+ const lb = vector3ToDevice(min, camera, w, h);
2364
+ const rt = vector3ToDevice(max, camera, w, h);
2365
+ const lt = vector3ToDevice(new Vector311(min.x, max.y, max.z), camera, w, h);
2366
+ const rb = vector3ToDevice(new Vector311(max.x, min.y, min.z), camera, w, h);
2367
+ const left = Math.min(lb.x, rt.x, lt.x, rb.x);
2368
+ const right = Math.max(lb.x, rt.x, lt.x, rb.x);
2369
+ const top = Math.min(lb.y, rt.y, lt.y, rb.y);
2370
+ const bottom = Math.max(lb.y, rt.y, lt.y, rb.y);
2371
+ return { left, right, top, bottom };
2366
2372
  }
2367
2373
  /**
2368
2374
  * 检测地图是不是在显示范围
2369
- * @param leftBottom
2370
- * @param rightTop
2371
- * @returns { boolean }
2375
+ * @param param0
2376
+ * @returns
2372
2377
  */
2373
- checkDistanceToScreenEdge(leftBottom, rightTop) {
2378
+ checkDistanceToScreenEdge({ left, right, top, bottom }) {
2374
2379
  const { width, height } = this.context.clientSize;
2375
2380
  const [pt, pr, pb, pl] = this.context.config.cameraBound.padding;
2376
- const left = leftBottom.x;
2377
- const right = width - rightTop.x;
2378
- const top = rightTop.y;
2379
- const bottom = height - leftBottom.y;
2380
- return left < pl && right < pr && top < pt && bottom < pb;
2381
+ return left <= pl && width - right <= pr && top <= pt && height - bottom <= pb;
2381
2382
  }
2382
2383
  dispose() {
2383
2384
  this.unRegistryEvent();