@aibee/crc-bmap 0.0.118 → 0.0.120

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
@@ -1622,7 +1622,7 @@ import {
1622
1622
  Vector3 as Vector317,
1623
1623
  Vector2 as Vector26,
1624
1624
  Raycaster as Raycaster3,
1625
- Box3 as Box310,
1625
+ Box3 as Box39,
1626
1626
  Color as Color6,
1627
1627
  AmbientLight as AmbientLight2
1628
1628
  } from "three";
@@ -3710,9 +3710,9 @@ var GlbModel = class extends Object3D11 {
3710
3710
 
3711
3711
  // src/elements/lane.ts
3712
3712
  import { BufferGeometry as BufferGeometry3, ExtrudeGeometry as ExtrudeGeometry4, LineSegments as LineSegments3, Mesh as Mesh6, Object3D as Object3D12, Vector3 as Vector313 } from "three";
3713
- import { mergeGeometries as mergeGeometries2 } from "three/examples/jsm/utils/BufferGeometryUtils";
3714
- import { Line2 } from "three/examples/jsm/lines/line2";
3715
- import { LineGeometry } from "three/examples/jsm/lines/lineGeometry";
3713
+ import { mergeGeometries as mergeGeometries2 } from "three/examples/jsm/utils/BufferGeometryUtils.js";
3714
+ import { Line2 } from "three/examples/jsm/lines/line2.js";
3715
+ import { LineGeometry } from "three/examples/jsm/lines/lineGeometry.js";
3716
3716
  var Lane = class extends Object3D12 {
3717
3717
  constructor(context, options) {
3718
3718
  super();
@@ -3807,7 +3807,7 @@ var Lane = class extends Object3D12 {
3807
3807
  geometry.setPositions(vec);
3808
3808
  const line = new Line2(geometry, material);
3809
3809
  line.computeLineDistances();
3810
- line.position.z += 1e-4;
3810
+ line.position.z += 1e-3;
3811
3811
  this.add(line);
3812
3812
  });
3813
3813
  });
@@ -4419,7 +4419,7 @@ var MaterialFactory = class {
4419
4419
  };
4420
4420
 
4421
4421
  // src/utils/camera-bound.ts
4422
- import { Box3 as Box39, Vector3 as Vector316 } from "three";
4422
+ import { Box3 as Box38, Vector3 as Vector316 } from "three";
4423
4423
  var CameraBound = class {
4424
4424
  constructor(context) {
4425
4425
  this.context = context;
@@ -4466,7 +4466,7 @@ var CameraBound = class {
4466
4466
  if (!floors.length) {
4467
4467
  return null;
4468
4468
  }
4469
- const box = new Box39().setFromObject(this.context.scene);
4469
+ const box = new Box38().setFromObject(this.context.scene);
4470
4470
  const { camera, clientSize: { width: w, height: h } } = this.context;
4471
4471
  const { min, max } = box;
4472
4472
  const lb = vector3ToDevice(min, camera, w, h);
@@ -4855,7 +4855,7 @@ var Context = class extends EventDispatcher6 {
4855
4855
  if (force2DView) {
4856
4856
  this.setPolarAngle(0, 0);
4857
4857
  }
4858
- const boundingBox = new Box310().setFromObject(object);
4858
+ const boundingBox = new Box39().setFromObject(object);
4859
4859
  this.setPolarAngle(polar, 0);
4860
4860
  const { max, min } = boundingBox;
4861
4861
  const leftTop = new Vector317(min.x, max.y, max.z);
@@ -4951,7 +4951,7 @@ var Context = class extends EventDispatcher6 {
4951
4951
  this.tweenGroup.getAll().forEach((item) => item.stop());
4952
4952
  this.tweenGroup.removeAll();
4953
4953
  this.unRegistryEvent();
4954
- this.container.removeChild(this.renderer.domElement);
4954
+ this.renderer.domElement.remove();
4955
4955
  this.timer.dispose();
4956
4956
  this.renderer.dispose();
4957
4957
  this.lights.children.forEach(
@@ -7172,8 +7172,18 @@ var AibeeLoader = class {
7172
7172
  return null;
7173
7173
  }
7174
7174
  const cacheKey = this.getFloorCacheKey(floorInfo);
7175
- const cacheVersion = await this.getCacheData(VersionStoreName, cacheKey);
7176
- return this.getFloorDataByFloorInfo(floorInfo);
7175
+ try {
7176
+ const cacheVersion = await this.getCacheData(VersionStoreName, cacheKey);
7177
+ if (cacheVersion === floorInfo.version_id) {
7178
+ const res = await this.getCacheData(MapDataStoreName, cacheKey);
7179
+ if (res) {
7180
+ return this.getDataByJson(res);
7181
+ }
7182
+ }
7183
+ return this.getFloorDataByFloorInfo(floorInfo);
7184
+ } catch {
7185
+ return this.getFloorDataByFloorInfo(floorInfo);
7186
+ }
7177
7187
  }
7178
7188
  async getFloorDataByFloorInfo(floorInfo) {
7179
7189
  const cacheKey = this.getFloorCacheKey(floorInfo);
@@ -7186,9 +7196,26 @@ var AibeeLoader = class {
7186
7196
  }
7187
7197
  // 获取路网数据
7188
7198
  async getRoadNetworkData() {
7189
- return Promise.all(this.floors.map(async (item) => {
7190
- return fetch(item.route_url).then((res) => res.json());
7199
+ const res = await Promise.all(this.floors.map(async (item) => {
7200
+ const cacheKey = this.getFloorCacheKey(item);
7201
+ try {
7202
+ const cacheVersion = await this.getCacheData(VersionStoreName, cacheKey);
7203
+ if (cacheVersion === item.version_id) {
7204
+ const res2 = await this.getCacheData(RoadNetworkDataStoreName, cacheKey);
7205
+ if (res2) {
7206
+ return res2;
7207
+ }
7208
+ }
7209
+ const route = await fetch(item.route_url).then((res2) => res2.json());
7210
+ await this.setCacheData(RoadNetworkDataStoreName, cacheKey, route);
7211
+ return route;
7212
+ } catch {
7213
+ const route = await fetch(item.route_url).then((res2) => res2.json());
7214
+ await this.setCacheData(RoadNetworkDataStoreName, cacheKey, route);
7215
+ return route;
7216
+ }
7191
7217
  }));
7218
+ return res.filter((item) => item.points);
7192
7219
  }
7193
7220
  // 空闲时间请求其他数据
7194
7221
  async getOtherDataByFreeTime() {