@aibee/crc-bmap 0.0.75 → 0.0.76

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
@@ -1020,7 +1020,6 @@ var Poi = class extends EventDispatcher2 {
1020
1020
  this.overlay.div.style.userSelect = `none`;
1021
1021
  this.overlay.div.appendChild(div);
1022
1022
  this.div = div;
1023
- this._changePosition();
1024
1023
  this.resetSize();
1025
1024
  return div;
1026
1025
  }
@@ -2213,8 +2212,8 @@ var Selection = class extends EventDispatcher4 {
2213
2212
  this.dispatchEvent({ type: "select", graphics: [...this._list], isMultipleSelect: this.isMultipleSelect });
2214
2213
  }
2215
2214
  registryEvent() {
2216
- this.context.container.addEventListener("pointerdown", this.onPointerDown, true);
2217
- this.context.container.addEventListener("pointerup", this.onPointerUp, true);
2215
+ this.context.container.addEventListener("pointerdown", this.onPointerDown);
2216
+ this.context.container.addEventListener("pointerup", this.onPointerUp);
2218
2217
  this.context.container.addEventListener("pointerout", this.onPointerOut);
2219
2218
  this.context.container.addEventListener("pointercancel", this.onPointerOut);
2220
2219
  window.addEventListener("keydown", this.onKeyDown);
@@ -2222,8 +2221,8 @@ var Selection = class extends EventDispatcher4 {
2222
2221
  this.boxSelection.addEventListener("selected", this.onBoxSelected);
2223
2222
  }
2224
2223
  unRegistryEvent() {
2225
- this.context.container.removeEventListener("pointerdown", this.onPointerDown, true);
2226
- this.context.container.removeEventListener("pointerup", this.onPointerUp, true);
2224
+ this.context.container.removeEventListener("pointerdown", this.onPointerDown);
2225
+ this.context.container.removeEventListener("pointerup", this.onPointerUp);
2227
2226
  this.context.container.removeEventListener("pointerout", this.onPointerOut);
2228
2227
  this.context.container.removeEventListener("pointercancel", this.onPointerOut);
2229
2228
  window.removeEventListener("keydown", this.onKeyDown);
@@ -2250,7 +2249,7 @@ var HoverHelper = class extends EventDispatcher5 {
2250
2249
  __publicField(this, "curGraphics", /* @__PURE__ */ new Set());
2251
2250
  __publicField(this, "timer", new Timer());
2252
2251
  __publicField(this, "graphicTimerMap", /* @__PURE__ */ new Map());
2253
- __publicField(this, "onPointerMove", ({ graphics, pois }) => {
2252
+ __publicField(this, "onPointerMove", ({ graphics, pois, e }) => {
2254
2253
  const poiGraphics = pois.map((item) => {
2255
2254
  var _a;
2256
2255
  return (_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.graphicMap.get(item.options.id);
@@ -2263,9 +2262,22 @@ var HoverHelper = class extends EventDispatcher5 {
2263
2262
  const { time } = this.context.config.hover;
2264
2263
  const allGraphics = new Set(graphics);
2265
2264
  if (!allGraphics.size) {
2266
- poiGraphics.forEach((graphic) => {
2267
- allGraphics.add(graphic);
2268
- });
2265
+ if (poiGraphics.length === 1) {
2266
+ allGraphics.add(poiGraphics[0]);
2267
+ } else if (poiGraphics.length) {
2268
+ let resGraphic;
2269
+ let distance = 1e4;
2270
+ poiGraphics.forEach((graphic) => {
2271
+ const poi = pois.find((poi2) => poi2.options.id === graphic.options.id);
2272
+ const { x, y } = poi.clientPos;
2273
+ let curDistance = Math.sqrt(__pow(x - e.offsetX, 2) + __pow(y - e.offsetY, 2));
2274
+ if (curDistance < distance) {
2275
+ distance = curDistance;
2276
+ resGraphic = graphic;
2277
+ }
2278
+ });
2279
+ allGraphics.add(resGraphic);
2280
+ }
2269
2281
  }
2270
2282
  allGraphics.forEach((graphic) => {
2271
2283
  if (this.graphicTimerMap.get(graphic)) {
@@ -2528,12 +2540,12 @@ var Context = class extends EventDispatcher6 {
2528
2540
  __publicField(this, "onPointerover", (e) => {
2529
2541
  const { graphics, position } = this.getGraphicsByDeviceXy(e.offsetX, e.offsetY);
2530
2542
  const pois = this.getPoisByDeviceXy(e.offsetX, e.offsetY);
2531
- this.dispatchEvent({ type: "pointer-over", graphics, pois, position });
2543
+ this.dispatchEvent({ type: "pointer-over", e, graphics, pois, position });
2532
2544
  });
2533
2545
  __publicField(this, "onPointermove", (e) => {
2534
2546
  const { graphics, position } = this.getGraphicsByDeviceXy(e.offsetX, e.offsetY);
2535
2547
  const pois = this.getPoisByDeviceXy(e.offsetX, e.offsetY);
2536
- this.dispatchEvent({ type: "pointer-move", graphics, pois, position });
2548
+ this.dispatchEvent({ type: "pointer-move", e, graphics, pois, position });
2537
2549
  });
2538
2550
  __publicField(this, "onPointerleave", () => {
2539
2551
  this.dispatchEvent({ type: "pointer-level" });