@aibee/crc-bmap 0.0.32 → 0.0.33

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
@@ -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
  }
@@ -947,8 +958,9 @@ var PoiLayer = class extends Layer {
947
958
  super(context);
948
959
  __publicField(this, "pois", []);
949
960
  __publicField(this, "debounceCollisionDetection");
961
+ __publicField(this, "timer", new Timer());
950
962
  __publicField(this, "onUpdate", () => {
951
- Promise.resolve().then(() => {
963
+ this.timer.requestAnimationFrame(() => {
952
964
  this.collisionDetection();
953
965
  });
954
966
  });
@@ -1035,10 +1047,7 @@ var PoiLayer = class extends Layer {
1035
1047
  collisionDetection() {
1036
1048
  const { clientSize: { width, height } } = this.context;
1037
1049
  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
- });
1050
+ const pois = this.pois.filter((item) => item.withinDisplayRange);
1042
1051
  pois.forEach((item, index) => {
1043
1052
  const { left, right, top, bottom } = item.getBox();
1044
1053
  if (index === 0) {
@@ -1064,6 +1073,7 @@ var PoiLayer = class extends Layer {
1064
1073
  this.context.removeEventListener("update", this.onUpdate);
1065
1074
  }
1066
1075
  dispose() {
1076
+ this.timer.dispose();
1067
1077
  this.pois.forEach((item) => item.dispose());
1068
1078
  this.pois.length = 0;
1069
1079
  this.debounceCollisionDetection = () => {