@aibee/crc-bmap 0.0.52 → 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/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.div.style.transform = `translate3d(${x}px, ${-height + y}px, 0)`;
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 defaultOptions2 = {
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({}, defaultOptions2), options), this);
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.container.clientWidth * 2 - 1;
2252
- point3.y = y / this.container.clientHeight * -2 + 1;
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);