@aibee/crc-bmap 0.0.21 → 0.0.23

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
@@ -707,7 +707,8 @@ var defaultOptions2 = {
707
707
  text: "",
708
708
  level: 1,
709
709
  collision_enable: true,
710
- opacity: 1
710
+ opacity: 1,
711
+ id: ""
711
712
  };
712
713
  var Poi = class extends Object3D4 {
713
714
  constructor(context, options) {
@@ -916,6 +917,12 @@ var PoiLayer = class extends Layer {
916
917
  this.remove(poi);
917
918
  poi.dispose();
918
919
  }
920
+ removePoiById(id) {
921
+ const poi = this.pois.find((item) => item.options.id === id);
922
+ if (poi) {
923
+ this.removePoi(poi);
924
+ }
925
+ }
919
926
  /**
920
927
  * 保存poi按照level排序
921
928
  * @param poi
@@ -1631,6 +1638,14 @@ var BoxSelection = class extends BaseSvg {
1631
1638
  const { context: { camera, container: { clientWidth: w, clientHeight: h } } } = this;
1632
1639
  if (!object)
1633
1640
  return false;
1641
+ if (!object.mesh) {
1642
+ const position = object.getPosition();
1643
+ if (position) {
1644
+ const position2d = vector3ToDevice(position, camera, w, h);
1645
+ return isContain(position2d, leftTop, rightBottom);
1646
+ }
1647
+ return false;
1648
+ }
1634
1649
  if (!object.mesh.geometry.boundingBox) {
1635
1650
  object.mesh.geometry.computeBoundingBox();
1636
1651
  }
@@ -2309,6 +2324,9 @@ var BMap = class extends EventDispatcher6 {
2309
2324
  }
2310
2325
  createGraphicPoi(graphic, options) {
2311
2326
  if (this.context.currentFloor) {
2327
+ if (options.id === void 0) {
2328
+ options.id = graphic.options.id;
2329
+ }
2312
2330
  const poi = this.context.currentFloor.addPoi(options);
2313
2331
  const position = graphic.getCenter();
2314
2332
  position.z += graphic.options.height / 2;
@@ -2507,6 +2525,10 @@ var BMap = class extends EventDispatcher6 {
2507
2525
  }
2508
2526
  return (_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.createGraphic(options);
2509
2527
  }
2528
+ removePoiById(id) {
2529
+ var _a;
2530
+ return (_a = this.context.currentFloor) == null ? void 0 : _a.poiLayer.removePoiById(id);
2531
+ }
2510
2532
  dispose() {
2511
2533
  this.context.dispose();
2512
2534
  clearTextTexture();