@aibee/crc-bmap 0.0.36 → 0.0.38

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
@@ -158,8 +158,6 @@ function initLight() {
158
158
  function initControl(camera, domElement) {
159
159
  const control = new MapControls(camera, domElement);
160
160
  control.enableDamping = false;
161
- control.maxPolarAngle = 0;
162
- control.minPolarAngle = 0;
163
161
  control.zoomSpeed = 2;
164
162
  return control;
165
163
  }
@@ -374,6 +372,11 @@ function sleepOnePromise() {
374
372
  return Promise.resolve();
375
373
  }
376
374
 
375
+ // src/utils/color.ts
376
+ function strToNumber(str) {
377
+ return parseInt(str.replace("#", "0x"), 16);
378
+ }
379
+
377
380
  // src/context.ts
378
381
  import {
379
382
  EventDispatcher as EventDispatcher5,
@@ -497,13 +500,15 @@ var Graphic = class extends Object3D {
497
500
  return size;
498
501
  }
499
502
  getPosition() {
500
- return this.getCenter();
503
+ const center2 = this.getCenter();
504
+ center2.setZ(center2.z + this.options.height);
505
+ return center2;
501
506
  }
502
507
  init() {
503
508
  this.geometry = this.initGeometry();
504
509
  this.material = this.initMaterial();
505
510
  this.mesh = this.initMesh();
506
- this.mesh.position.z = this.options.airHeight + this.options.height / 2;
511
+ this.mesh.position.z = this.options.airHeight;
507
512
  this.mesh.castShadow = true;
508
513
  this.add(this.mesh);
509
514
  this.line = this.createBorder();
@@ -548,7 +553,7 @@ var Graphic = class extends Object3D {
548
553
  const material = this.initLineMaterial();
549
554
  const geometry = new EdgesGeometry(this.geometry);
550
555
  const line = new LineSegments(geometry, material);
551
- line.position.z = this.options.airHeight + this.options.height / 2;
556
+ line.position.z = this.options.airHeight;
552
557
  return line;
553
558
  }
554
559
  raycast(raycaster) {
@@ -623,7 +628,7 @@ var Shadow = class extends Object3D2 {
623
628
  });
624
629
  const mesh = new Mesh2(geometry, material);
625
630
  mesh.receiveShadow = true;
626
- mesh.position.z = -5;
631
+ mesh.position.z = -10;
627
632
  this.add(mesh);
628
633
  this.plane = mesh;
629
634
  return mesh;
@@ -1998,7 +2003,6 @@ var Context = class extends EventDispatcher5 {
1998
2003
  position
1999
2004
  });
2000
2005
  }
2001
- console.log("onClick", e.offsetX, e.offsetY);
2002
2006
  const pois = this.getPoisByDeviceXy(e.offsetX, e.offsetY);
2003
2007
  if (pois.length) {
2004
2008
  this.dispatchEvent({ type: "poi-click", pois });
@@ -2042,6 +2046,7 @@ var Context = class extends EventDispatcher5 {
2042
2046
  this.camera = initCamera(w, h);
2043
2047
  this.renderer.setSize(w, h);
2044
2048
  this.control = initControl(this.camera, this.renderer.domElement);
2049
+ this.control.maxPolarAngle = this.config.control.maxPolar;
2045
2050
  this.container.appendChild(this.renderer.domElement);
2046
2051
  this.scene.add(this.lights);
2047
2052
  this.basicRatio = this.getRatio();
@@ -2142,6 +2147,8 @@ var Context = class extends EventDispatcher5 {
2142
2147
  this.control.update();
2143
2148
  }).onComplete(() => {
2144
2149
  this.control.enabled = true;
2150
+ this.control.maxPolarAngle = this.config.control.maxPolar;
2151
+ this.control.minPolarAngle = 0;
2145
2152
  this.tweenGroup.remove(tween);
2146
2153
  resolve(true);
2147
2154
  }).onStart(() => {
@@ -2290,7 +2297,7 @@ var defaultConfig = {
2290
2297
  },
2291
2298
  useFloorCache: true,
2292
2299
  control: {
2293
- maxPolar: 1.2
2300
+ maxPolar: 0.9
2294
2301
  },
2295
2302
  svg: {
2296
2303
  circle: {
@@ -2449,11 +2456,17 @@ var BMap = class extends EventDispatcher6 {
2449
2456
  const grounds = data.filter((item) => item.info.group === "ground");
2450
2457
  grounds.forEach((item) => {
2451
2458
  item.info.fillColor = "#F5F7F9";
2459
+ item.info.fillOpacity = 1;
2452
2460
  item.info.strokeOpacity = 0;
2461
+ item.info.height = 5;
2453
2462
  });
2454
2463
  const groundGraphics = grounds.map((ground) => new Graphic(this.context, ground.info));
2455
2464
  curFloor.addGrounds(groundGraphics);
2456
2465
  const graphicData = data.filter((item) => item.info.group !== "ground");
2466
+ graphicData.forEach((item, index) => {
2467
+ item.info.airHeight = 5;
2468
+ item.info.height = 5 + index * 1e-4;
2469
+ });
2457
2470
  const legacyToGraphicMap = /* @__PURE__ */ new Map();
2458
2471
  const graphics = graphicData.map((item) => {
2459
2472
  const graphic = curFloor.addGraphic(item.info);
@@ -2554,9 +2567,9 @@ var BMap = class extends EventDispatcher6 {
2554
2567
  */
2555
2568
  changeMapType(type, duration = 500) {
2556
2569
  if (type === "2d") {
2557
- this.context.setPolarAngle(0);
2570
+ return this.context.setPolarAngle(0, duration);
2558
2571
  } else {
2559
- this.context.setPolarAngle(1.2);
2572
+ return this.context.setPolarAngle(0.9, duration);
2560
2573
  }
2561
2574
  }
2562
2575
  /**
@@ -2780,6 +2793,7 @@ export {
2780
2793
  setLineStartEnd,
2781
2794
  setRectPosition,
2782
2795
  sleepOnePromise,
2796
+ strToNumber,
2783
2797
  timeoutPromise,
2784
2798
  vector3ToDevice
2785
2799
  };