@aibee/crc-bmap 0.0.63 → 0.0.65

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
@@ -1966,6 +1966,7 @@ var Selection = class extends EventDispatcher4 {
1966
1966
  __publicField(this, "prevPanStatus");
1967
1967
  __publicField(this, "prevRotateStatus");
1968
1968
  __publicField(this, "downPoint", null);
1969
+ __publicField(this, "isMultipleSelect", false);
1969
1970
  __publicField(this, "onPointerDown", (e) => {
1970
1971
  this.downPoint = { x: e.offsetX, y: e.offsetY };
1971
1972
  });
@@ -1985,7 +1986,7 @@ var Selection = class extends EventDispatcher4 {
1985
1986
  var _a;
1986
1987
  if (!graphicIdSet.has(item.options.id)) {
1987
1988
  const graphic = ((_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.graphicMap.get(item.options.id)) || null;
1988
- if (graphic) {
1989
+ if (graphic && graphic.options.geometry.type === "point") {
1989
1990
  graphics.push(graphic);
1990
1991
  graphicIdSet.add(item.options.id);
1991
1992
  }
@@ -2000,6 +2001,7 @@ var Selection = class extends EventDispatcher4 {
2000
2001
  });
2001
2002
  __publicField(this, "onKeyDown", (e) => {
2002
2003
  if (e.key === "Control") {
2004
+ this.isMultipleSelect = true;
2003
2005
  this.boxSelection.setEnable(true);
2004
2006
  this.prevPanStatus = this.context.control.enablePan;
2005
2007
  this.prevRotateStatus = this.context.control.enableRotate;
@@ -2009,6 +2011,7 @@ var Selection = class extends EventDispatcher4 {
2009
2011
  });
2010
2012
  __publicField(this, "onKeyUp", (e) => {
2011
2013
  if (e.key === "Control") {
2014
+ this.isMultipleSelect = false;
2012
2015
  this.boxSelection.setEnable(false);
2013
2016
  this.context.control.enablePan = !!this.prevPanStatus;
2014
2017
  this.context.control.enableRotate = !!this.prevRotateStatus;
@@ -2029,7 +2032,7 @@ var Selection = class extends EventDispatcher4 {
2029
2032
  return this._list;
2030
2033
  }
2031
2034
  selectEnd() {
2032
- this.dispatchEvent({ type: "select", graphics: [...this._list] });
2035
+ this.dispatchEvent({ type: "select", graphics: [...this._list], isMultipleSelect: this.isMultipleSelect });
2033
2036
  }
2034
2037
  registryEvent() {
2035
2038
  this.context.container.addEventListener("pointerdown", this.onPointerDown);
@@ -2069,14 +2072,19 @@ var HoverHelper = class extends EventDispatcher5 {
2069
2072
  const poiGraphics = pois.map((item) => {
2070
2073
  var _a;
2071
2074
  return (_a = this.context.currentFloor) == null ? void 0 : _a.graphicLayer.graphicMap.get(item.options.id);
2072
- });
2075
+ }).filter((graphic) => graphic && graphic.options.geometry.type === "point");
2073
2076
  if (!graphics.length && !poiGraphics && this.curGraphics.size) {
2074
2077
  this.curGraphics.clear();
2075
2078
  this.handleHoverGraphicsChange();
2076
2079
  return;
2077
2080
  }
2078
2081
  const { time } = this.context.config.hover;
2079
- const allGraphics = /* @__PURE__ */ new Set([...graphics, ...poiGraphics]);
2082
+ const allGraphics = new Set(graphics);
2083
+ if (!allGraphics.size) {
2084
+ poiGraphics.forEach((graphic) => {
2085
+ allGraphics.add(graphic);
2086
+ });
2087
+ }
2080
2088
  allGraphics.forEach((graphic) => {
2081
2089
  if (this.graphicTimerMap.get(graphic)) {
2082
2090
  return;
@@ -2244,8 +2252,8 @@ var Context = class extends EventDispatcher6 {
2244
2252
  __publicField(this, "onPointerleave", () => {
2245
2253
  this.dispatchEvent({ type: "pointer-level" });
2246
2254
  });
2247
- __publicField(this, "onSelectionSelect", ({ graphics }) => {
2248
- this.dispatchEvent({ type: "select-graphic", graphics });
2255
+ __publicField(this, "onSelectionSelect", ({ graphics, isMultipleSelect }) => {
2256
+ this.dispatchEvent({ type: "select-graphic", graphics, isMultipleSelect });
2249
2257
  });
2250
2258
  __publicField(this, "onHoverChange", ({ graphics }) => {
2251
2259
  this.dispatchEvent({ type: "hover", graphics });
@@ -2477,11 +2485,13 @@ var Context = class extends EventDispatcher6 {
2477
2485
  * @param duration
2478
2486
  * @returns
2479
2487
  */
2480
- fitCameraToObject(object, padding = [20, 20, 20, 20], duration = 500) {
2488
+ fitCameraToObject(object, padding = [20, 20, 20, 20], duration = 500, force2DView = true) {
2481
2489
  const [top, right, bottom, left] = padding;
2482
2490
  const { clientSize: { width, height } } = this;
2483
2491
  const polar = this.control.getPolarAngle();
2484
- this.setPolarAngle(0, 0);
2492
+ if (force2DView) {
2493
+ this.setPolarAngle(0, 0);
2494
+ }
2485
2495
  const boundingBox = new Box36().setFromObject(object);
2486
2496
  this.setPolarAngle(polar, 0);
2487
2497
  const { max, min } = boundingBox;
@@ -2498,9 +2508,9 @@ var Context = class extends EventDispatcher6 {
2498
2508
  const center2 = new Vector39((max.x + min.x) / 2, (max.y + min.y) / 2, max.z);
2499
2509
  return this.setZoom(scale * this.camera.zoom, center2, duration);
2500
2510
  }
2501
- fitCameraToGround(padding = [20, 20, 20, 20], duration = 500) {
2511
+ fitCameraToGround(padding = [20, 20, 20, 20], duration = 500, force2DView = true) {
2502
2512
  if (this.currentFloor && this.currentFloor.hasElement) {
2503
- return this.fitCameraToObject(this.currentFloor.groundUpper, padding, duration);
2513
+ return this.fitCameraToObject(this.currentFloor.groundUpper, padding, duration, force2DView);
2504
2514
  } else {
2505
2515
  return Promise.resolve(false);
2506
2516
  }
@@ -2842,6 +2852,9 @@ var BMap = class extends EventDispatcher7 {
2842
2852
  this.context.control.minZoom = this.basicZoom;
2843
2853
  this.context.control.maxZoom = this.basicZoom * 25;
2844
2854
  this.context.control.addEventListener("change", this.onControlChange);
2855
+ if (this.type === "3d") {
2856
+ this.context.fitCameraToGround([80, 20, 80, 20], 0, false);
2857
+ }
2845
2858
  this.onControlChange();
2846
2859
  } else {
2847
2860
  console.warn("[switchFloor error] [" + floor + "] \u697C\u5C42\u6CA1\u6709\u6570\u636E");