@aibee/crc-bmap 0.0.10 → 0.0.12

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
@@ -373,10 +373,10 @@ function setRectPosition(rect, x, y, w, h) {
373
373
  import {
374
374
  EventDispatcher as EventDispatcher5,
375
375
  Box2,
376
- Vector3 as Vector36,
376
+ Vector3 as Vector37,
377
377
  Vector2 as Vector23,
378
- Raycaster as Raycaster2,
379
- Box3 as Box33,
378
+ Raycaster as Raycaster3,
379
+ Box3 as Box34,
380
380
  Color as Color4,
381
381
  AmbientLight as AmbientLight2
382
382
  } from "three";
@@ -779,6 +779,9 @@ var Poi = class extends Object3D4 {
779
779
  // src/elements/floor.ts
780
780
  import { Object3D as Object3D7 } from "three";
781
781
 
782
+ // src/layer/graphic-layer.ts
783
+ import { Box3 as Box33, Vector3 as Vector34 } from "three";
784
+
782
785
  // src/layer/layer.ts
783
786
  import { Object3D as Object3D5 } from "three";
784
787
  var Layer = class extends Object3D5 {
@@ -797,6 +800,10 @@ var GraphicLayer = class extends Layer {
797
800
  constructor(context) {
798
801
  super(context);
799
802
  }
803
+ getCenter() {
804
+ const box = new Box33().setFromObject(this);
805
+ return box.getCenter(new Vector34());
806
+ }
800
807
  createGraphic(options) {
801
808
  const graphic = new Graphic(this.context, options);
802
809
  this.add(graphic);
@@ -1092,7 +1099,7 @@ var Floor = class extends Object3D7 {
1092
1099
  };
1093
1100
 
1094
1101
  // src/elements/base-svg.ts
1095
- import { EventDispatcher as EventDispatcher2, Vector3 as Vector34 } from "three";
1102
+ import { EventDispatcher as EventDispatcher2, Vector3 as Vector35 } from "three";
1096
1103
  var BaseSvg = class extends EventDispatcher2 {
1097
1104
  constructor(context) {
1098
1105
  super();
@@ -1117,7 +1124,7 @@ var BaseSvg = class extends EventDispatcher2 {
1117
1124
  const { clientWidth, clientHeight } = renderer.domElement;
1118
1125
  const nx = x / clientWidth * 2 - 1;
1119
1126
  const ny = 1 - y / clientHeight * 2;
1120
- const v = new Vector34(nx, ny, 0);
1127
+ const v = new Vector35(nx, ny, 0);
1121
1128
  return v.unproject(camera);
1122
1129
  }
1123
1130
  getSvgCoordinate(vector) {
@@ -1711,7 +1718,7 @@ var Context = class extends EventDispatcher5 {
1711
1718
  /**
1712
1719
  * 获取两个点之间的像素数
1713
1720
  */
1714
- getRatio(point1 = new Vector36(0, 0, 0), point22 = new Vector36(100, 0, 0)) {
1721
+ getRatio(point1 = new Vector37(0, 0, 0), point22 = new Vector37(100, 0, 0)) {
1715
1722
  const { clientWidth, clientHeight } = this.container;
1716
1723
  const device1 = vector3ToDevice(point1, this.camera, clientWidth, clientHeight);
1717
1724
  const device2 = vector3ToDevice(point22, this.camera, clientWidth, clientHeight);
@@ -1732,7 +1739,7 @@ var Context = class extends EventDispatcher5 {
1732
1739
  }
1733
1740
  this.currentFloor = floor;
1734
1741
  this.scene.add(floor);
1735
- const position = (_a = floor.ground) == null ? void 0 : _a.getCenter();
1742
+ const position = (_a = floor.graphicLayer) == null ? void 0 : _a.getCenter();
1736
1743
  if (position) {
1737
1744
  this.lights.position.x = position.x;
1738
1745
  this.lights.position.y = position.y;
@@ -1749,7 +1756,7 @@ var Context = class extends EventDispatcher5 {
1749
1756
  const point3 = new Vector23();
1750
1757
  point3.x = x / this.container.clientWidth * 2 - 1;
1751
1758
  point3.y = y / this.container.clientHeight * -2 + 1;
1752
- const raycaster = new Raycaster2();
1759
+ const raycaster = new Raycaster3();
1753
1760
  raycaster.setFromCamera(point3, this.camera);
1754
1761
  const res = (_a = this.currentFloor) == null ? void 0 : _a.graphicLayer.getGraphicByRaycaster(raycaster);
1755
1762
  return res || { graphics: [], position: null };
@@ -1808,7 +1815,7 @@ var Context = class extends EventDispatcher5 {
1808
1815
  );
1809
1816
  }
1810
1817
  getCameraLookAt() {
1811
- return new Vector36().subVectors(this.control.target, this.camera.position);
1818
+ return new Vector37().subVectors(this.control.target, this.camera.position);
1812
1819
  }
1813
1820
  /**
1814
1821
  * 按照一个中心点设置相机的放大缩小
@@ -1856,7 +1863,7 @@ var Context = class extends EventDispatcher5 {
1856
1863
  fitCameraToObject(object, padding = [20, 20, 20, 20], duration = 500) {
1857
1864
  const [top, right, bottom, left] = padding;
1858
1865
  const { clientWidth, clientHeight } = this.container;
1859
- const boundingBox = new Box33().setFromObject(object);
1866
+ const boundingBox = new Box34().setFromObject(object);
1860
1867
  const { max, min } = boundingBox;
1861
1868
  const max2d = vector3ToDevice(max, this.camera, clientWidth, clientHeight);
1862
1869
  const min2d = vector3ToDevice(min, this.camera, clientWidth, clientHeight);
@@ -1868,7 +1875,7 @@ var Context = class extends EventDispatcher5 {
1868
1875
  const xScale = (clientWidth - right - left) / size.x;
1869
1876
  const yScale = (clientHeight - top - bottom) / size.y;
1870
1877
  const scale = Math.min(xScale, yScale);
1871
- const center2 = new Vector36((max.x + min.x) / 2, (max.y + min.y) / 2, max.z);
1878
+ const center2 = new Vector37((max.x + min.x) / 2, (max.y + min.y) / 2, max.z);
1872
1879
  return this.setZoom(scale * this.camera.zoom, center2, duration);
1873
1880
  }
1874
1881
  fitCameraToGround(padding = [20, 20, 20, 20], duration = 500) {
@@ -2064,10 +2071,10 @@ var BMap = class extends EventDispatcher6 {
2064
2071
  });
2065
2072
  }
2066
2073
  createFloor(data) {
2074
+ const curFloor = new Floor(this.context);
2067
2075
  if (!data.length) {
2068
- return null;
2076
+ return { curFloor, graphics: [] };
2069
2077
  }
2070
- const curFloor = new Floor(this.context);
2071
2078
  const list = [...data];
2072
2079
  let groundIndex = data.findIndex((item) => item.info.group === "ground");
2073
2080
  if (groundIndex !== -1) {