@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.cjs.min.js +1 -1
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +15 -14
- package/lib/bmap.esm.js.map +2 -2
- package/lib/bmap.esm.min.js +1 -1
- package/lib/bmap.esm.min.js.map +3 -3
- package/lib/bmap.min.js +1 -1
- package/lib/bmap.min.js.map +3 -3
- package/lib/src/utils/camera-bound.d.ts +11 -17
- package/package.json +1 -1
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 {
|
|
2316
|
-
const isInBound = this.checkDistanceToScreenEdge(
|
|
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
|
|
2364
|
-
const
|
|
2365
|
-
|
|
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
|
|
2370
|
-
* @
|
|
2371
|
-
* @returns { boolean }
|
|
2375
|
+
* @param param0
|
|
2376
|
+
* @returns
|
|
2372
2377
|
*/
|
|
2373
|
-
checkDistanceToScreenEdge(
|
|
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
|
-
|
|
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();
|