@aibee/crc-bmap 0.0.38 → 0.0.40

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
@@ -176,7 +176,7 @@ function initDirectionalLight(color = 16777215, intensity = 1) {
176
176
  directionalLight.castShadow = true;
177
177
  directionalLight.shadow.radius = 8;
178
178
  directionalLight.shadow.bias = -1e-3;
179
- directionalLight.shadow.mapSize.set(64, 64);
179
+ directionalLight.shadow.mapSize.set(128, 128);
180
180
  directionalLight.shadow.camera.left = -200;
181
181
  directionalLight.shadow.camera.right = 200;
182
182
  directionalLight.shadow.camera.top = 200;
@@ -401,12 +401,13 @@ import {
401
401
  Mesh,
402
402
  Color as Color2,
403
403
  Box3,
404
- LineSegments,
405
404
  EdgesGeometry,
406
- LineBasicMaterial,
407
405
  Vector3
408
406
  } from "three";
409
407
  import { merge } from "lodash";
408
+ import { LineMaterial } from "three/examples/jsm/lines/LineMaterial.js";
409
+ import { LineSegmentsGeometry } from "three/examples/jsm/lines/LineSegmentsGeometry.js";
410
+ import { LineSegments2 } from "three/examples/jsm/lines/LineSegments2.js";
410
411
  var defaultOptions = {
411
412
  id: "",
412
413
  // 图形id
@@ -426,6 +427,8 @@ var defaultOptions = {
426
427
  // 透明度
427
428
  strokeOpacity: 1,
428
429
  // 描边透明度
430
+ strokeWidth: 1,
431
+ // 描边宽度
429
432
  doors: [],
430
433
  // 门配置
431
434
  locked: false,
@@ -472,6 +475,9 @@ var Graphic = class extends Object3D {
472
475
  this.addEventListener("change-strokeOpacity", ({ value }) => {
473
476
  this.line.material.opacity = value;
474
477
  });
478
+ this.addEventListener("change-strokeWidth", ({ value }) => {
479
+ this.line.material.linewidth = value;
480
+ });
475
481
  this.addEventListener("change-airHeight", ({ value }) => {
476
482
  this.position.z = value;
477
483
  });
@@ -538,12 +544,17 @@ var Graphic = class extends Object3D {
538
544
  return material;
539
545
  }
540
546
  initLineMaterial() {
541
- const lineMaterial = new LineBasicMaterial({
542
- color: this.options.strokeColor,
547
+ const lineMaterial = new LineMaterial({
548
+ color: new Color2(this.options.strokeColor).getHex(),
543
549
  opacity: this.options.strokeOpacity,
544
550
  transparent: true,
545
- depthWrite: true
551
+ depthWrite: true,
552
+ linewidth: this.options.strokeWidth,
553
+ wireframe: false,
554
+ dashed: false
546
555
  });
556
+ const { clientSize: { width, height } } = this.context;
557
+ lineMaterial.resolution.set(width, height);
547
558
  return lineMaterial;
548
559
  }
549
560
  initMesh() {
@@ -552,7 +563,9 @@ var Graphic = class extends Object3D {
552
563
  createBorder() {
553
564
  const material = this.initLineMaterial();
554
565
  const geometry = new EdgesGeometry(this.geometry);
555
- const line = new LineSegments(geometry, material);
566
+ const lineGeometry = new LineSegmentsGeometry();
567
+ lineGeometry.fromEdgesGeometry(geometry);
568
+ const line = new LineSegments2(lineGeometry, material);
556
569
  line.position.z = this.options.airHeight;
557
570
  return line;
558
571
  }
@@ -1208,6 +1221,7 @@ var Floor = class extends Object3D7 {
1208
1221
  __publicField(this, "shadow", new Shadow());
1209
1222
  __publicField(this, "heatmap");
1210
1223
  __publicField(this, "groundUpper", new Object3D7());
1224
+ __publicField(this, "groundMaxHeight", 0);
1211
1225
  this.graphicLayer = new GraphicLayer(this.context);
1212
1226
  this.poiLayer = new PoiLayer(this.context);
1213
1227
  this.groundUpper.add(this.graphicLayer);
@@ -1221,6 +1235,11 @@ var Floor = class extends Object3D7 {
1221
1235
  this.groundUpper.add(ground);
1222
1236
  }
1223
1237
  });
1238
+ this.changeGroundMaxHeight();
1239
+ }
1240
+ changeGroundMaxHeight() {
1241
+ const grounds = Array.from(this.grounds);
1242
+ this.groundMaxHeight = this.grounds.size > 0 ? Math.max(...grounds.map((ground) => ground.options.height + ground.options.airHeight)) : 0;
1224
1243
  }
1225
1244
  get hasElement() {
1226
1245
  return !!(this.grounds.size || this.graphicLayer.children.length);
@@ -1237,6 +1256,7 @@ var Floor = class extends Object3D7 {
1237
1256
  this.add(this.shadow);
1238
1257
  }
1239
1258
  addGraphic(graphicOptions) {
1259
+ graphicOptions.airHeight = Math.max(this.groundMaxHeight, graphicOptions.airHeight || 0);
1240
1260
  return this.graphicLayer.createGraphic(graphicOptions);
1241
1261
  }
1242
1262
  addPoi(poiOptions) {