@aibee/crc-bmap 0.0.58 → 0.0.60

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
@@ -453,6 +453,7 @@ var defaultOptions = {
453
453
  layerType: "",
454
454
  zIndex: 0,
455
455
  stroke: true,
456
+ deltaHeight: 0,
456
457
  userData: {}
457
458
  };
458
459
  var Graphic = class extends Object3D {
@@ -565,7 +566,7 @@ var Graphic = class extends Object3D {
565
566
  const geometry = new ExtrudeGeometry(shape, {
566
567
  steps: 1,
567
568
  bevelEnabled: false,
568
- depth: this.options.height,
569
+ depth: this.options.height + this.options.deltaHeight,
569
570
  curveSegments: 4
570
571
  });
571
572
  return geometry;
@@ -595,7 +596,7 @@ var Graphic = class extends Object3D {
595
596
  }
596
597
  getBorderPoints() {
597
598
  const points = [];
598
- const height = this.options.height;
599
+ const height = this.options.height + this.options.deltaHeight;
599
600
  const { cds, curveIndex } = this.options.geometry;
600
601
  for (let j = 0; j < cds.length; j++) {
601
602
  const curCds = cds[j];
@@ -1018,6 +1019,7 @@ var GraphicLayer = class extends Layer {
1018
1019
  return box.getCenter(new Vector35());
1019
1020
  }
1020
1021
  createGraphic(options) {
1022
+ options.deltaHeight = 1e-5 * this.graphicMap.size;
1021
1023
  const graphic = new Graphic(this.context, options);
1022
1024
  this.add(graphic);
1023
1025
  this.graphicMap.set(options.id, graphic);
@@ -1312,10 +1314,14 @@ var Floor = class extends Object3D7 {
1312
1314
  this.groundUpper.add(this.poiLayer);
1313
1315
  this.add(this.groundUpper);
1314
1316
  }
1317
+ createGround(options) {
1318
+ options.deltaHeight = 1e-5 * this.grounds.size;
1319
+ const ground = new Graphic(this.context, options);
1320
+ this.addGrounds([ground]);
1321
+ }
1315
1322
  addGrounds(grounds) {
1316
1323
  grounds.forEach((ground) => {
1317
1324
  if (!this.grounds.has(ground)) {
1318
- ground.options.height += ground.options.zIndex / 1e4;
1319
1325
  ground.mesh.castShadow = true;
1320
1326
  this.grounds.add(ground);
1321
1327
  this.groundUpper.add(ground);
@@ -1343,7 +1349,6 @@ var Floor = class extends Object3D7 {
1343
1349
  this.add(this.shadow);
1344
1350
  }
1345
1351
  addGraphic(graphicOptions) {
1346
- graphicOptions.height += this.graphicLayer.graphicMap.size * 1e-5;
1347
1352
  return this.graphicLayer.createGraphic(graphicOptions);
1348
1353
  }
1349
1354
  addPoi(poiOptions) {
@@ -2160,7 +2165,9 @@ var Context = class extends EventDispatcher6 {
2160
2165
  });
2161
2166
  __publicField(this, "onWindowResize", () => {
2162
2167
  const { container, camera, renderer } = this;
2163
- const { clientWidth: w, clientHeight: h } = container;
2168
+ let { clientWidth: w, clientHeight: h } = container;
2169
+ w = Math.max(1, w);
2170
+ h = Math.max(1, h);
2164
2171
  camera.left = -w / 2;
2165
2172
  camera.right = w / 2;
2166
2173
  camera.top = h / 2;
@@ -2564,6 +2571,9 @@ var defaultConfig = {
2564
2571
  stroke: false,
2565
2572
  strokeColor: "#000",
2566
2573
  strokeOpacity: 1
2574
+ },
2575
+ graphic: {
2576
+ fillOpacity: 1
2567
2577
  }
2568
2578
  };
2569
2579
  function getConfig(config) {
@@ -2714,7 +2724,7 @@ var BMap = class extends EventDispatcher7 {
2714
2724
  item.info.transformToBuildingGround = true;
2715
2725
  });
2716
2726
  }
2717
- const { ground, markGraphic } = this.config;
2727
+ const { ground, markGraphic, graphic } = this.config;
2718
2728
  for (const item of data) {
2719
2729
  if (item.info.group === "ground") {
2720
2730
  item.info.fillColor = ground.color;
@@ -2723,15 +2733,15 @@ var BMap = class extends EventDispatcher7 {
2723
2733
  item.info.stroke = ground.stroke;
2724
2734
  item.info.strokeColor = ground.strokeColor;
2725
2735
  item.info.strokeOpacity = ground.strokeOpacity;
2736
+ } else if (item.info.userData.mark) {
2737
+ item.info.height = markGraphic.height;
2738
+ item.info.fillColor = markGraphic.color;
2739
+ item.info.fillOpacity = markGraphic.opacity;
2740
+ item.info.stroke = markGraphic.stroke;
2741
+ item.info.strokeColor = markGraphic.strokeColor;
2742
+ item.info.strokeOpacity = markGraphic.strokeOpacity;
2726
2743
  } else {
2727
- if (item.info.userData.mark) {
2728
- item.info.height = markGraphic.height;
2729
- item.info.fillColor = markGraphic.color;
2730
- item.info.fillOpacity = markGraphic.opacity;
2731
- item.info.stroke = markGraphic.stroke;
2732
- item.info.strokeColor = markGraphic.strokeColor;
2733
- item.info.strokeOpacity = markGraphic.strokeOpacity;
2734
- }
2744
+ item.info.fillOpacity = graphic.fillOpacity;
2735
2745
  }
2736
2746
  }
2737
2747
  if (!this.config.useFloorCache) {
@@ -2750,7 +2760,7 @@ var BMap = class extends EventDispatcher7 {
2750
2760
  const graphics = [];
2751
2761
  for (const item of data) {
2752
2762
  if (item.info.group === "ground") {
2753
- curFloor.addGrounds([new Graphic(this.context, item.info)]);
2763
+ curFloor.createGround(item.info);
2754
2764
  } else {
2755
2765
  const graphic = curFloor.addGraphic(item.info);
2756
2766
  graphic.userData.data = item;