@aibee/crc-bmap 0.0.3-gamma → 0.0.3
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/example/src/main.ts +4 -4
- package/lib/bmap.cjs.min.js +1 -1
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +49 -26
- package/lib/bmap.esm.js.map +3 -3
- 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/bmap.d.ts +1 -0
- package/lib/src/elements/graphic.d.ts +1 -0
- package/lib/src/elements/shadow.d.ts +5 -3
- package/package.json +2 -2
package/lib/bmap.esm.js
CHANGED
|
@@ -173,6 +173,7 @@ function initDirectionalLight(color = 16777215, intensity = 1) {
|
|
|
173
173
|
const directionalLight = new DirectionalLight(color, intensity);
|
|
174
174
|
directionalLight.castShadow = true;
|
|
175
175
|
directionalLight.shadow.radius = 8;
|
|
176
|
+
directionalLight.shadow.bias = -1e-3;
|
|
176
177
|
directionalLight.shadow.mapSize.set(64, 64);
|
|
177
178
|
directionalLight.shadow.camera.left = -200;
|
|
178
179
|
directionalLight.shadow.camera.right = 200;
|
|
@@ -768,11 +769,18 @@ var Graphic = class extends Object3D2 {
|
|
|
768
769
|
box.getCenter(center2);
|
|
769
770
|
return center2;
|
|
770
771
|
}
|
|
772
|
+
getSize() {
|
|
773
|
+
const box = new Box32();
|
|
774
|
+
const size = new Vector32();
|
|
775
|
+
box.setFromObject(this);
|
|
776
|
+
box.getSize(size);
|
|
777
|
+
return size;
|
|
778
|
+
}
|
|
771
779
|
init() {
|
|
772
780
|
this.geometry = this.initGeometry();
|
|
773
781
|
this.material = this.initMaterial();
|
|
774
782
|
this.mesh = this.initMesh();
|
|
775
|
-
this.mesh.position.z = this.options.airHeight;
|
|
783
|
+
this.mesh.position.z = this.options.airHeight + this.options.height / 2;
|
|
776
784
|
this.mesh.castShadow = true;
|
|
777
785
|
this.add(this.mesh);
|
|
778
786
|
this.line = this.createBorder();
|
|
@@ -840,9 +848,7 @@ import {
|
|
|
840
848
|
Mesh as Mesh2,
|
|
841
849
|
ShadowMaterial,
|
|
842
850
|
Color as Color4,
|
|
843
|
-
|
|
844
|
-
BoxGeometry,
|
|
845
|
-
MeshBasicMaterial
|
|
851
|
+
DoubleSide
|
|
846
852
|
} from "three";
|
|
847
853
|
var Shadow = class extends Object3D3 {
|
|
848
854
|
constructor() {
|
|
@@ -851,37 +857,41 @@ var Shadow = class extends Object3D3 {
|
|
|
851
857
|
__publicField(this, "plane");
|
|
852
858
|
__publicField(this, "basicOpacity", 0.39);
|
|
853
859
|
this.directionalLight = this.initLight();
|
|
854
|
-
this.
|
|
860
|
+
this.initPlane();
|
|
855
861
|
}
|
|
856
862
|
// 创建光源
|
|
857
863
|
initLight() {
|
|
858
|
-
const directionalLight = initDirectionalLight(16777215,
|
|
864
|
+
const directionalLight = initDirectionalLight(16777215, 1);
|
|
859
865
|
directionalLight.position.set(0, 0, 100);
|
|
860
|
-
const helper = new DirectionalLightHelper(directionalLight, 100);
|
|
861
|
-
const geometry = new BoxGeometry(10, 10, 10);
|
|
862
|
-
const material = new MeshBasicMaterial({ color: 16773120 });
|
|
863
|
-
const mesh = new Mesh2(geometry, material);
|
|
864
|
-
mesh.position.set(0, 0, 100);
|
|
865
866
|
this.add(directionalLight);
|
|
866
|
-
this.add(helper);
|
|
867
|
-
this.add(mesh);
|
|
868
867
|
return directionalLight;
|
|
869
868
|
}
|
|
869
|
+
changeLightCamera(size) {
|
|
870
|
+
const x = size.x;
|
|
871
|
+
const y = size.y;
|
|
872
|
+
this.directionalLight.shadow.camera.left = -x;
|
|
873
|
+
this.directionalLight.shadow.camera.right = x;
|
|
874
|
+
this.directionalLight.shadow.camera.top = y;
|
|
875
|
+
this.directionalLight.shadow.camera.bottom = -y;
|
|
876
|
+
this.directionalLight.shadow.camera.near = 0.5;
|
|
877
|
+
this.directionalLight.shadow.camera.far = Math.max(x, y);
|
|
878
|
+
}
|
|
870
879
|
changeLightColor(color) {
|
|
871
880
|
this.directionalLight.color = new Color4(color);
|
|
872
881
|
}
|
|
873
882
|
// 创建平面白色
|
|
874
|
-
initPlane() {
|
|
875
|
-
const geometry = new PlaneGeometry(
|
|
883
|
+
initPlane(width = 1e4, height = 1e4) {
|
|
884
|
+
const geometry = new PlaneGeometry(width, height);
|
|
876
885
|
const material = new ShadowMaterial({
|
|
877
886
|
transparent: true,
|
|
878
887
|
opacity: 0,
|
|
879
|
-
|
|
888
|
+
side: DoubleSide
|
|
880
889
|
});
|
|
881
890
|
const mesh = new Mesh2(geometry, material);
|
|
882
891
|
mesh.receiveShadow = true;
|
|
883
|
-
mesh.position.z = -
|
|
892
|
+
mesh.position.z = -20;
|
|
884
893
|
this.add(mesh);
|
|
894
|
+
this.plane = mesh;
|
|
885
895
|
return mesh;
|
|
886
896
|
}
|
|
887
897
|
setTarget(target) {
|
|
@@ -891,7 +901,7 @@ var Shadow = class extends Object3D3 {
|
|
|
891
901
|
return opacity * this.basicOpacity;
|
|
892
902
|
}
|
|
893
903
|
setOpacity(opacity) {
|
|
894
|
-
this.plane.material.opacity =
|
|
904
|
+
this.plane.material.opacity = this.transformOpacity(opacity);
|
|
895
905
|
}
|
|
896
906
|
dispose() {
|
|
897
907
|
dispose(this, true);
|
|
@@ -903,14 +913,14 @@ import { Object3D as Object3D5 } from "three";
|
|
|
903
913
|
import { merge as merge3 } from "lodash";
|
|
904
914
|
|
|
905
915
|
// src/elements/overlay.ts
|
|
906
|
-
import { EventDispatcher as EventDispatcher2, Vector3 as
|
|
916
|
+
import { EventDispatcher as EventDispatcher2, Vector3 as Vector34 } from "three";
|
|
907
917
|
var Overlay = class extends EventDispatcher2 {
|
|
908
918
|
constructor(context) {
|
|
909
919
|
super();
|
|
910
920
|
this.context = context;
|
|
911
921
|
__publicField(this, "div");
|
|
912
922
|
__publicField(this, "element");
|
|
913
|
-
__publicField(this, "position", new
|
|
923
|
+
__publicField(this, "position", new Vector34());
|
|
914
924
|
__publicField(this, "onUpdate", () => {
|
|
915
925
|
const vector = this.getPosition();
|
|
916
926
|
const { clientWidth, clientHeight } = this.context.container;
|
|
@@ -1199,11 +1209,11 @@ var PoiLayer = class extends Layer {
|
|
|
1199
1209
|
|
|
1200
1210
|
// src/elements/heatmap.ts
|
|
1201
1211
|
import {
|
|
1202
|
-
MeshBasicMaterial
|
|
1212
|
+
MeshBasicMaterial,
|
|
1203
1213
|
Object3D as Object3D7,
|
|
1204
1214
|
PlaneGeometry as PlaneGeometry2,
|
|
1205
1215
|
Texture,
|
|
1206
|
-
DoubleSide,
|
|
1216
|
+
DoubleSide as DoubleSide2,
|
|
1207
1217
|
Mesh as Mesh3,
|
|
1208
1218
|
Matrix3,
|
|
1209
1219
|
Vector2 as Vector22
|
|
@@ -1244,9 +1254,9 @@ var HeatmapElement = class extends Object3D7 {
|
|
|
1244
1254
|
const geometry = new PlaneGeometry2(width, height);
|
|
1245
1255
|
const texture = new Texture(this.div.firstChild);
|
|
1246
1256
|
texture.needsUpdate = true;
|
|
1247
|
-
const material = new
|
|
1257
|
+
const material = new MeshBasicMaterial({
|
|
1248
1258
|
transparent: true,
|
|
1249
|
-
side:
|
|
1259
|
+
side: DoubleSide2,
|
|
1250
1260
|
map: texture
|
|
1251
1261
|
});
|
|
1252
1262
|
material.needsUpdate = true;
|
|
@@ -1313,8 +1323,10 @@ var Floor = class extends Object3D8 {
|
|
|
1313
1323
|
this.ground = ground;
|
|
1314
1324
|
this.add(ground);
|
|
1315
1325
|
const center2 = ground.getCenter();
|
|
1326
|
+
const size = ground.getSize();
|
|
1316
1327
|
this.shadow.position.x = center2.x;
|
|
1317
1328
|
this.shadow.position.y = center2.y;
|
|
1329
|
+
this.shadow.changeLightCamera(size);
|
|
1318
1330
|
this.shadow.setTarget(ground);
|
|
1319
1331
|
}
|
|
1320
1332
|
addGraphic(graphicOptions) {
|
|
@@ -1656,7 +1668,7 @@ var BMap = class extends EventDispatcher4 {
|
|
|
1656
1668
|
__publicField(this, "floorDataMap", /* @__PURE__ */ new Map());
|
|
1657
1669
|
__publicField(this, "onKeydown", (e) => {
|
|
1658
1670
|
if (this.polarKeys.includes(e.code)) {
|
|
1659
|
-
this.context.control.maxPolarAngle =
|
|
1671
|
+
this.context.control.maxPolarAngle = this.config.control.maxPolar;
|
|
1660
1672
|
this.context.control.minPolarAngle = 0;
|
|
1661
1673
|
}
|
|
1662
1674
|
if (this.azimuthalKeys.includes(e.code)) {
|
|
@@ -1737,11 +1749,18 @@ var BMap = class extends EventDispatcher4 {
|
|
|
1737
1749
|
groundIndex = 0;
|
|
1738
1750
|
}
|
|
1739
1751
|
const ground = data[groundIndex];
|
|
1752
|
+
console.log(ground.info.height, ground.info.airHeight);
|
|
1740
1753
|
const list = [...data];
|
|
1741
1754
|
list.splice(groundIndex, 1);
|
|
1742
1755
|
const groundGraphic = new Graphic(this.context, ground.info);
|
|
1743
1756
|
curFloor.addGround(groundGraphic);
|
|
1744
|
-
const
|
|
1757
|
+
const legacyToGraphicMap = /* @__PURE__ */ new Map();
|
|
1758
|
+
const graphics = list.map((item) => {
|
|
1759
|
+
const graphic = curFloor.addGraphic(item.info);
|
|
1760
|
+
legacyToGraphicMap.set(item.legacy_id, graphic);
|
|
1761
|
+
return graphic;
|
|
1762
|
+
});
|
|
1763
|
+
curFloor.userData.legacyToGraphicMap = legacyToGraphicMap;
|
|
1745
1764
|
return { curFloor, ground: groundGraphic, graphics };
|
|
1746
1765
|
}
|
|
1747
1766
|
switchFloor(floor) {
|
|
@@ -1758,6 +1777,10 @@ var BMap = class extends EventDispatcher4 {
|
|
|
1758
1777
|
var _a;
|
|
1759
1778
|
return (_a = this.context.currentFloor) == null ? void 0 : _a.addHeatmap(data);
|
|
1760
1779
|
}
|
|
1780
|
+
getLegacyToGraphicMap() {
|
|
1781
|
+
var _a;
|
|
1782
|
+
return ((_a = this.context.currentFloor) == null ? void 0 : _a.userData.legacyToGraphicMap) || /* @__PURE__ */ new Map();
|
|
1783
|
+
}
|
|
1761
1784
|
removeHeatMap() {
|
|
1762
1785
|
var _a;
|
|
1763
1786
|
(_a = this.context.currentFloor) == null ? void 0 : _a.removeHeatMap();
|