@aibee/crc-bmap 0.0.14 → 0.0.15

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
@@ -159,8 +159,6 @@ function initControl(camera, domElement) {
159
159
  control.minPolarAngle = 0;
160
160
  control.maxAzimuthAngle = 0;
161
161
  control.minAzimuthAngle = 0;
162
- control.minZoom = 1;
163
- control.maxZoom = 100;
164
162
  return control;
165
163
  }
166
164
  function initShape(path, holePath = []) {
@@ -441,6 +439,12 @@ var Graphic = class extends Object3D {
441
439
  __publicField(this, "line");
442
440
  __publicField(this, "options");
443
441
  this.options = proxyOptions(merge({}, defaultOptions, options), this);
442
+ if (this.options.geometry.type === "point") {
443
+ const [x, y] = this.options.geometry.cds;
444
+ this.position.set(x, y, this.options.height + this.options.airHeight);
445
+ console.log(this.options);
446
+ return this;
447
+ }
444
448
  this.init();
445
449
  this.visible = this.options.visible;
446
450
  this.addEventListener("change-fillColor", ({ value }) => {
@@ -467,6 +471,9 @@ var Graphic = class extends Object3D {
467
471
  });
468
472
  }
469
473
  getCenter() {
474
+ if (this.options.geometry.type === "point") {
475
+ return this.position;
476
+ }
470
477
  const center2 = new Vector3();
471
478
  const box = new Box3();
472
479
  box.setFromObject(this);
@@ -474,6 +481,9 @@ var Graphic = class extends Object3D {
474
481
  return center2;
475
482
  }
476
483
  getSize() {
484
+ if (this.options.geometry.type === "point") {
485
+ return new Vector3(0, 0, 0);
486
+ }
477
487
  const box = new Box3();
478
488
  const size = new Vector3();
479
489
  box.setFromObject(this);
@@ -494,7 +504,10 @@ var Graphic = class extends Object3D {
494
504
  this.add(this.line);
495
505
  }
496
506
  initGeometry() {
497
- const shape = initShape(this.options.geometry.cds[0], this.options.geometry.cds.slice(1));
507
+ const shape = initShape(
508
+ this.options.geometry.cds[0],
509
+ this.options.geometry.cds.slice(1)
510
+ );
498
511
  const geometry = new ExtrudeGeometry(shape, {
499
512
  steps: 1,
500
513
  bevelEnabled: false,
@@ -536,6 +549,9 @@ var Graphic = class extends Object3D {
536
549
  if (!this.visible) {
537
550
  return false;
538
551
  }
552
+ if (this.options.geometry.type === "point") {
553
+ return false;
554
+ }
539
555
  const intersects = raycaster.intersectObject(this.mesh);
540
556
  if (intersects[0]) {
541
557
  const { point: position, distance } = intersects[0];
@@ -2094,14 +2110,19 @@ var BMap = class extends EventDispatcher6 {
2094
2110
  if (buildGround) {
2095
2111
  const center2 = getCenter(buildGround.info.geometry.cds[0]);
2096
2112
  data.forEach((item) => {
2097
- item.info.geometry.cds.map((cds) => {
2098
- if (Array.isArray(cds)) {
2099
- cds.forEach((coord) => {
2100
- coord[0] -= center2[0];
2101
- coord[1] -= center2[1];
2102
- });
2103
- }
2104
- });
2113
+ if (item.info.geometry.type === "polygon") {
2114
+ item.info.geometry.cds.map((cds) => {
2115
+ if (Array.isArray(cds)) {
2116
+ cds.forEach((coord) => {
2117
+ coord[0] -= center2[0];
2118
+ coord[1] -= center2[1];
2119
+ });
2120
+ }
2121
+ });
2122
+ } else {
2123
+ const [x, y] = item.info.geometry.cds;
2124
+ item.info.geometry.cds = [x - center2[0], y - center2[1]];
2125
+ }
2105
2126
  });
2106
2127
  }
2107
2128
  if (!this.config.useFloorCache) {
@@ -2140,6 +2161,8 @@ var BMap = class extends EventDispatcher6 {
2140
2161
  this.context.switchFloor(createdFloor.curFloor);
2141
2162
  yield this.context.fitCameraToGround(void 0, 0);
2142
2163
  this.basicZoom = this.context.camera.zoom;
2164
+ this.context.control.minZoom = this.basicZoom;
2165
+ this.context.control.maxZoom = this.basicZoom * 25;
2143
2166
  } else {
2144
2167
  console.warn("[switchFloor error] [" + floor + "] \u697C\u5C42\u6CA1\u6709\u6570\u636E");
2145
2168
  }