@aibee/crc-bmap 0.0.60 → 0.0.62
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 +1 -1
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +38 -12
- 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/elements/poi.d.ts +6 -0
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -302,8 +302,11 @@ function proxyOptions(target, master) {
|
|
|
302
302
|
return Reflect.get(target2, p, receiver);
|
|
303
303
|
},
|
|
304
304
|
set: (target2, p, newValue, receiver) => {
|
|
305
|
+
const oldValue = Reflect.get(target2, p, receiver);
|
|
305
306
|
const res = Reflect.set(target2, p, newValue, receiver);
|
|
306
|
-
|
|
307
|
+
if (oldValue !== newValue) {
|
|
308
|
+
master.dispatchEvent({ type: `change-${p}`, value: newValue });
|
|
309
|
+
}
|
|
307
310
|
return res;
|
|
308
311
|
}
|
|
309
312
|
});
|
|
@@ -551,7 +554,7 @@ var Graphic = class extends Object3D {
|
|
|
551
554
|
this.geometry = this.initGeometry();
|
|
552
555
|
this.initMaterial();
|
|
553
556
|
this.initMesh();
|
|
554
|
-
this.mesh.position.z = this.options.airHeight;
|
|
557
|
+
this.mesh.position.z = this.options.airHeight + this.options.deltaHeight;
|
|
555
558
|
if (this.options.stroke) {
|
|
556
559
|
this.initLineMaterial();
|
|
557
560
|
this.initLineGeometry();
|
|
@@ -566,7 +569,7 @@ var Graphic = class extends Object3D {
|
|
|
566
569
|
const geometry = new ExtrudeGeometry(shape, {
|
|
567
570
|
steps: 1,
|
|
568
571
|
bevelEnabled: false,
|
|
569
|
-
depth: this.options.height
|
|
572
|
+
depth: this.options.height,
|
|
570
573
|
curveSegments: 4
|
|
571
574
|
});
|
|
572
575
|
return geometry;
|
|
@@ -805,7 +808,7 @@ var Overlay = class extends EventDispatcher {
|
|
|
805
808
|
dispose() {
|
|
806
809
|
this.unRegistryEvent();
|
|
807
810
|
this.unBindElement();
|
|
808
|
-
this.context.container.removeChild(this.div);
|
|
811
|
+
this.div && this.context.container.removeChild(this.div);
|
|
809
812
|
this.div = null;
|
|
810
813
|
}
|
|
811
814
|
};
|
|
@@ -817,7 +820,10 @@ var defaultOptions3 = {
|
|
|
817
820
|
collision_enable: true,
|
|
818
821
|
opacity: 1,
|
|
819
822
|
id: "",
|
|
820
|
-
position: { x: 0, y: 0, z: 0 }
|
|
823
|
+
position: { x: 0, y: 0, z: 0 },
|
|
824
|
+
icon_opacity: 1,
|
|
825
|
+
icon_border: { color: "#586EE0", width: 0 },
|
|
826
|
+
background: ""
|
|
821
827
|
};
|
|
822
828
|
var Poi = class extends EventDispatcher2 {
|
|
823
829
|
constructor(context, options) {
|
|
@@ -869,6 +875,20 @@ var Poi = class extends EventDispatcher2 {
|
|
|
869
875
|
this.resetSize();
|
|
870
876
|
}
|
|
871
877
|
});
|
|
878
|
+
this.addEventListener("change-icon_opacity", ({ value }) => {
|
|
879
|
+
if (this.img) {
|
|
880
|
+
this.img.style.opacity = `${value}`;
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
this.addEventListener("change-icon_border", ({ value }) => {
|
|
884
|
+
if (this.img) {
|
|
885
|
+
this.img.style.border = `${value.width}px solid ${value.color}`;
|
|
886
|
+
this.resetSize();
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
this.addEventListener("change-background", ({ value }) => {
|
|
890
|
+
this.div.style.background = value;
|
|
891
|
+
});
|
|
872
892
|
}
|
|
873
893
|
get withinDisplayRange() {
|
|
874
894
|
return this.overlay.withinDisplayRange;
|
|
@@ -904,6 +924,7 @@ var Poi = class extends EventDispatcher2 {
|
|
|
904
924
|
div.style.flexDirection = `column`;
|
|
905
925
|
div.style.justifyContent = `center`;
|
|
906
926
|
div.style.alignItems = `center`;
|
|
927
|
+
div.style.padding = "4px";
|
|
907
928
|
this.overlay.setOpacity(this.options.opacity);
|
|
908
929
|
this.overlay.div.style.pointerEvents = `none`;
|
|
909
930
|
this.overlay.div.style.userSelect = `none`;
|
|
@@ -919,8 +940,7 @@ var Poi = class extends EventDispatcher2 {
|
|
|
919
940
|
initText() {
|
|
920
941
|
const textDiv = document.createElement("div");
|
|
921
942
|
textDiv.appendChild(this.createTextFragment());
|
|
922
|
-
|
|
923
|
-
}
|
|
943
|
+
textDiv.style.textAlign = "center";
|
|
924
944
|
this.textDiv = textDiv;
|
|
925
945
|
return textDiv;
|
|
926
946
|
}
|
|
@@ -945,6 +965,11 @@ var Poi = class extends EventDispatcher2 {
|
|
|
945
965
|
img.setAttribute("src", this.options.icon);
|
|
946
966
|
img.style.width = `${((_a = this.options.icon_size) == null ? void 0 : _a[0]) || 32}px`;
|
|
947
967
|
img.style.height = `${((_b = this.options.icon_size) == null ? void 0 : _b[1]) || 32}px`;
|
|
968
|
+
img.style.opacity = `${this.options.icon_opacity}px`;
|
|
969
|
+
img.style.borderRadius = "50%";
|
|
970
|
+
if (this.options.icon_border.width) {
|
|
971
|
+
img.style.border = `${this.options.icon_border.width}px solid ${this.options.icon_border.color}`;
|
|
972
|
+
}
|
|
948
973
|
img.onload = () => {
|
|
949
974
|
this._changePosition();
|
|
950
975
|
this.resetSize();
|
|
@@ -1019,7 +1044,6 @@ var GraphicLayer = class extends Layer {
|
|
|
1019
1044
|
return box.getCenter(new Vector35());
|
|
1020
1045
|
}
|
|
1021
1046
|
createGraphic(options) {
|
|
1022
|
-
options.deltaHeight = 1e-5 * this.graphicMap.size;
|
|
1023
1047
|
const graphic = new Graphic(this.context, options);
|
|
1024
1048
|
this.add(graphic);
|
|
1025
1049
|
this.graphicMap.set(options.id, graphic);
|
|
@@ -1315,7 +1339,6 @@ var Floor = class extends Object3D7 {
|
|
|
1315
1339
|
this.add(this.groundUpper);
|
|
1316
1340
|
}
|
|
1317
1341
|
createGround(options) {
|
|
1318
|
-
options.deltaHeight = 1e-5 * this.grounds.size;
|
|
1319
1342
|
const ground = new Graphic(this.context, options);
|
|
1320
1343
|
this.addGrounds([ground]);
|
|
1321
1344
|
}
|
|
@@ -1331,7 +1354,7 @@ var Floor = class extends Object3D7 {
|
|
|
1331
1354
|
}
|
|
1332
1355
|
changeGroundMaxHeight() {
|
|
1333
1356
|
const grounds = Array.from(this.grounds);
|
|
1334
|
-
this.groundMaxHeight = this.grounds.size > 0 ? Math.max(...grounds.map((ground) => ground.options.height + ground.options.airHeight)) : 0;
|
|
1357
|
+
this.groundMaxHeight = this.grounds.size > 0 ? Math.max(...grounds.map((ground) => ground.options.height + ground.options.airHeight + ground.options.deltaHeight)) : 0;
|
|
1335
1358
|
this.graphicLayer.position.z = this.groundMaxHeight;
|
|
1336
1359
|
}
|
|
1337
1360
|
get hasElement() {
|
|
@@ -2581,6 +2604,7 @@ function getConfig(config) {
|
|
|
2581
2604
|
}
|
|
2582
2605
|
|
|
2583
2606
|
// src/bmap.ts
|
|
2607
|
+
import { debounce as debounce2 } from "lodash";
|
|
2584
2608
|
var MapTypePolar = /* @__PURE__ */ ((MapTypePolar2) => {
|
|
2585
2609
|
MapTypePolar2[MapTypePolar2["D2"] = 0] = "D2";
|
|
2586
2610
|
MapTypePolar2[MapTypePolar2["D3"] = 0.9] = "D3";
|
|
@@ -2725,7 +2749,9 @@ var BMap = class extends EventDispatcher7 {
|
|
|
2725
2749
|
});
|
|
2726
2750
|
}
|
|
2727
2751
|
const { ground, markGraphic, graphic } = this.config;
|
|
2728
|
-
for (
|
|
2752
|
+
for (let i = 0; i < data.length; i++) {
|
|
2753
|
+
const item = data[i];
|
|
2754
|
+
item.info.deltaHeight = 1e-5 * (i + 1);
|
|
2729
2755
|
if (item.info.group === "ground") {
|
|
2730
2756
|
item.info.fillColor = ground.color;
|
|
2731
2757
|
item.info.fillOpacity = ground.opacity;
|
|
@@ -2907,7 +2933,7 @@ var BMap = class extends EventDispatcher7 {
|
|
|
2907
2933
|
window.addEventListener("keydown", this.onKeydown);
|
|
2908
2934
|
window.addEventListener("keyup", this.onKeyUp);
|
|
2909
2935
|
if (this.config.resizeObserver) {
|
|
2910
|
-
const observe = new ResizeObserver(this.resize);
|
|
2936
|
+
const observe = new ResizeObserver(debounce2(this.resize, 5));
|
|
2911
2937
|
observe.observe(this.container);
|
|
2912
2938
|
this.observe = observe;
|
|
2913
2939
|
}
|