@aibee/crc-bmap 0.0.51 → 0.0.53
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 +21 -7
- package/example/vite.config.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 +16 -7
- 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/overlay.d.ts +15 -2
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -724,8 +724,11 @@ import { EventDispatcher as EventDispatcher2, Vector3 as Vector34 } from "three"
|
|
|
724
724
|
|
|
725
725
|
// src/elements/overlay.ts
|
|
726
726
|
import { Box3 as Box32, EventDispatcher, Vector3 as Vector33 } from "three";
|
|
727
|
+
var defaultOptions2 = {
|
|
728
|
+
autoUpdate: true
|
|
729
|
+
};
|
|
727
730
|
var Overlay = class extends EventDispatcher {
|
|
728
|
-
constructor(context) {
|
|
731
|
+
constructor(context, options = {}) {
|
|
729
732
|
super();
|
|
730
733
|
this.context = context;
|
|
731
734
|
__publicField(this, "div");
|
|
@@ -733,6 +736,7 @@ var Overlay = class extends EventDispatcher {
|
|
|
733
736
|
__publicField(this, "position", new Vector33());
|
|
734
737
|
__publicField(this, "clientPos", { x: 0, y: 0 });
|
|
735
738
|
__publicField(this, "visible", true);
|
|
739
|
+
__publicField(this, "options");
|
|
736
740
|
__publicField(this, "onUpdate", () => {
|
|
737
741
|
const vector = this.getPosition();
|
|
738
742
|
const { width, height } = this.context.clientSize;
|
|
@@ -741,8 +745,13 @@ var Overlay = class extends EventDispatcher {
|
|
|
741
745
|
return;
|
|
742
746
|
}
|
|
743
747
|
this.clientPos = { x, y };
|
|
744
|
-
this.
|
|
748
|
+
if (this.options.autoUpdate) {
|
|
749
|
+
this.div.style.transform = `translate3d(${x}px, ${-height + y}px, 0)`;
|
|
750
|
+
} else {
|
|
751
|
+
this.dispatchEvent({ type: "update-position", x, y, width, height });
|
|
752
|
+
}
|
|
745
753
|
});
|
|
754
|
+
this.options = __spreadValues(__spreadValues({}, defaultOptions2), options);
|
|
746
755
|
this.registryEvent();
|
|
747
756
|
this.div = this.initDiv();
|
|
748
757
|
this.context.container.appendChild(this.div);
|
|
@@ -801,7 +810,7 @@ var Overlay = class extends EventDispatcher {
|
|
|
801
810
|
};
|
|
802
811
|
|
|
803
812
|
// src/elements/poi.ts
|
|
804
|
-
var
|
|
813
|
+
var defaultOptions3 = {
|
|
805
814
|
texts: [{ text: "" }],
|
|
806
815
|
level: 1,
|
|
807
816
|
collision_enable: true,
|
|
@@ -824,7 +833,7 @@ var Poi = class extends EventDispatcher2 {
|
|
|
824
833
|
__publicField(this, "_changePosition", () => {
|
|
825
834
|
this.div.style.transform = `translate3d(-50%, ${this.options.icon ? "-100%" : "-50%"}, 0)`;
|
|
826
835
|
});
|
|
827
|
-
this.options = proxyOptions(__spreadValues(__spreadValues({},
|
|
836
|
+
this.options = proxyOptions(__spreadValues(__spreadValues({}, defaultOptions3), options), this);
|
|
828
837
|
this.position.set(((_a = options.position) == null ? void 0 : _a.x) || 0, ((_b = options.position) == null ? void 0 : _b.y) || 0, ((_c = options.position) == null ? void 0 : _c.z) || 0);
|
|
829
838
|
this.overlay = new Overlay(this.context);
|
|
830
839
|
this.overlay.bindElement(this);
|
|
@@ -2248,8 +2257,8 @@ var Context = class extends EventDispatcher6 {
|
|
|
2248
2257
|
getGraphicsByDeviceXy(x, y) {
|
|
2249
2258
|
var _a;
|
|
2250
2259
|
const point3 = new Vector23();
|
|
2251
|
-
point3.x = x / this.
|
|
2252
|
-
point3.y = y / this.
|
|
2260
|
+
point3.x = x / this.clientSize.width * 2 - 1;
|
|
2261
|
+
point3.y = y / this.clientSize.height * -2 + 1;
|
|
2253
2262
|
const raycaster = new Raycaster3();
|
|
2254
2263
|
raycaster.setFromCamera(point3, this.camera);
|
|
2255
2264
|
const res = (_a = this.currentFloor) == null ? void 0 : _a.graphicLayer.getGraphicByRaycaster(raycaster);
|
|
@@ -2519,7 +2528,7 @@ var defaultConfig = {
|
|
|
2519
2528
|
fill: "rgba(28, 173, 255, 0.3)"
|
|
2520
2529
|
},
|
|
2521
2530
|
hover: {
|
|
2522
|
-
time:
|
|
2531
|
+
time: 100
|
|
2523
2532
|
},
|
|
2524
2533
|
ground: {
|
|
2525
2534
|
color: "#ffffff",
|