@aibee/crc-bmap 0.0.32 → 0.0.34
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 +1 -1
- package/lib/bmap.cjs.min.js +2 -2
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +34 -16
- package/lib/bmap.esm.js.map +2 -2
- package/lib/bmap.esm.min.js +2 -2
- package/lib/bmap.esm.min.js.map +3 -3
- package/lib/bmap.min.js +2 -2
- package/lib/bmap.min.js.map +3 -3
- package/lib/src/bmap.d.ts +1 -1
- package/lib/src/elements/overlay.d.ts +1 -0
- package/lib/src/elements/poi.d.ts +1 -0
- package/lib/src/layer/graphic-layer.d.ts +3 -0
- package/lib/src/layer/poi-layer.d.ts +2 -0
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -160,6 +160,7 @@ function initControl(camera, domElement) {
|
|
|
160
160
|
control.enableDamping = false;
|
|
161
161
|
control.maxPolarAngle = 0;
|
|
162
162
|
control.minPolarAngle = 0;
|
|
163
|
+
control.zoomSpeed = 2;
|
|
163
164
|
return control;
|
|
164
165
|
}
|
|
165
166
|
function initShape(path, holePath = []) {
|
|
@@ -660,6 +661,9 @@ var Overlay = class extends EventDispatcher {
|
|
|
660
661
|
const vector = this.getPosition();
|
|
661
662
|
const { width, height } = this.context.clientSize;
|
|
662
663
|
const { x, y } = vector3ToDevice(vector, this.context.camera, width, height);
|
|
664
|
+
if (this.clientPos.x === x && this.clientPos.y === y) {
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
663
667
|
this.clientPos = { x, y };
|
|
664
668
|
this.div.style.left = `${x}px`;
|
|
665
669
|
this.div.style.top = `${y}px`;
|
|
@@ -702,6 +706,11 @@ var Overlay = class extends EventDispatcher {
|
|
|
702
706
|
return this.position;
|
|
703
707
|
}
|
|
704
708
|
}
|
|
709
|
+
get withinDisplayRange() {
|
|
710
|
+
const { x, y } = this.clientPos;
|
|
711
|
+
const { width, height } = this.context.clientSize;
|
|
712
|
+
return x >= 0 && x <= width && y >= 0 && y <= height;
|
|
713
|
+
}
|
|
705
714
|
registryEvent() {
|
|
706
715
|
this.context.addEventListener("update", this.onUpdate);
|
|
707
716
|
}
|
|
@@ -773,19 +782,21 @@ var Poi = class extends Object3D4 {
|
|
|
773
782
|
}
|
|
774
783
|
});
|
|
775
784
|
}
|
|
785
|
+
get withinDisplayRange() {
|
|
786
|
+
return this.overlay.withinDisplayRange;
|
|
787
|
+
}
|
|
776
788
|
resetSize() {
|
|
777
789
|
return __async(this, null, function* () {
|
|
778
790
|
const visible = this.overlay.visible;
|
|
779
791
|
this.setVisible(true);
|
|
780
792
|
yield sleepOnePromise();
|
|
781
793
|
const { width, height } = this.overlay.div.getBoundingClientRect();
|
|
782
|
-
console.log(width, height);
|
|
783
794
|
this.size = {
|
|
784
795
|
width,
|
|
785
796
|
height
|
|
786
797
|
};
|
|
787
|
-
this._changePosition();
|
|
788
798
|
yield sleepOnePromise();
|
|
799
|
+
this._changePosition();
|
|
789
800
|
this.setVisible(visible);
|
|
790
801
|
});
|
|
791
802
|
}
|
|
@@ -909,6 +920,19 @@ var GraphicLayer = class extends Layer {
|
|
|
909
920
|
this.graphicMap.set(options.id, graphic);
|
|
910
921
|
return graphic;
|
|
911
922
|
}
|
|
923
|
+
removeGraphic(graphic) {
|
|
924
|
+
this.remove(graphic);
|
|
925
|
+
this.graphicMap.delete(graphic.options.id);
|
|
926
|
+
graphic.dispose();
|
|
927
|
+
}
|
|
928
|
+
removeGraphicById(id) {
|
|
929
|
+
if (this.graphicMap.has(id)) {
|
|
930
|
+
this.removeGraphic(this.graphicMap.get(id));
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
getGraphicByNodeId(id) {
|
|
934
|
+
return this.graphicMap.get(id) || null;
|
|
935
|
+
}
|
|
912
936
|
/**
|
|
913
937
|
* 获取射线相交的元素
|
|
914
938
|
* @param raycaster
|
|
@@ -947,8 +971,9 @@ var PoiLayer = class extends Layer {
|
|
|
947
971
|
super(context);
|
|
948
972
|
__publicField(this, "pois", []);
|
|
949
973
|
__publicField(this, "debounceCollisionDetection");
|
|
974
|
+
__publicField(this, "timer", new Timer());
|
|
950
975
|
__publicField(this, "onUpdate", () => {
|
|
951
|
-
|
|
976
|
+
this.timer.requestAnimationFrame(() => {
|
|
952
977
|
this.collisionDetection();
|
|
953
978
|
});
|
|
954
979
|
});
|
|
@@ -1035,10 +1060,7 @@ var PoiLayer = class extends Layer {
|
|
|
1035
1060
|
collisionDetection() {
|
|
1036
1061
|
const { clientSize: { width, height } } = this.context;
|
|
1037
1062
|
const range = [];
|
|
1038
|
-
const pois = this.pois.filter((item) =>
|
|
1039
|
-
const { x, y } = item.clientPos;
|
|
1040
|
-
return !(x < 0 || x > width || y < 0 || y > height);
|
|
1041
|
-
});
|
|
1063
|
+
const pois = this.pois.filter((item) => item.withinDisplayRange);
|
|
1042
1064
|
pois.forEach((item, index) => {
|
|
1043
1065
|
const { left, right, top, bottom } = item.getBox();
|
|
1044
1066
|
if (index === 0) {
|
|
@@ -1064,6 +1086,7 @@ var PoiLayer = class extends Layer {
|
|
|
1064
1086
|
this.context.removeEventListener("update", this.onUpdate);
|
|
1065
1087
|
}
|
|
1066
1088
|
dispose() {
|
|
1089
|
+
this.timer.dispose();
|
|
1067
1090
|
this.pois.forEach((item) => item.dispose());
|
|
1068
1091
|
this.pois.length = 0;
|
|
1069
1092
|
this.debounceCollisionDetection = () => {
|
|
@@ -2649,17 +2672,12 @@ var BMap = class extends EventDispatcher6 {
|
|
|
2649
2672
|
* 根据nodeId 获取graphic
|
|
2650
2673
|
*/
|
|
2651
2674
|
getGraphicByNodeId(nodeId) {
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
}
|
|
2655
|
-
return null;
|
|
2675
|
+
var _a;
|
|
2676
|
+
return ((_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.getGraphicByNodeId(nodeId)) || null;
|
|
2656
2677
|
}
|
|
2657
2678
|
deleteGraphic(graphic) {
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
graphic.dispose();
|
|
2661
|
-
this.context.currentFloor.graphicLayer.graphicMap.delete(graphic.options.id);
|
|
2662
|
-
}
|
|
2679
|
+
var _a;
|
|
2680
|
+
(_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.removeGraphic(graphic);
|
|
2663
2681
|
}
|
|
2664
2682
|
createGraphicByOptions(options) {
|
|
2665
2683
|
var _a;
|