@aibee/crc-bmap 0.0.46 → 0.0.48

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
@@ -112,7 +112,6 @@ import {
112
112
  Scene,
113
113
  WebGLRenderer,
114
114
  OrthographicCamera,
115
- HemisphereLight,
116
115
  Shape,
117
116
  PCFSoftShadowMap,
118
117
  Group,
@@ -129,7 +128,14 @@ function initScene() {
129
128
  return scene;
130
129
  }
131
130
  function initRenderer() {
132
- const renderer = new WebGLRenderer({ antialias: true });
131
+ const renderer = new WebGLRenderer({
132
+ antialias: true
133
+ // logarithmicDepthBuffer: true,
134
+ // alpha: false,
135
+ // premultipliedAlpha: false
136
+ });
137
+ renderer.autoClear = true;
138
+ renderer.setClearAlpha(1);
133
139
  renderer.setClearColor(16777215);
134
140
  renderer.setPixelRatio(window.devicePixelRatio);
135
141
  renderer.shadowMap.enabled = true;
@@ -146,12 +152,7 @@ function initCamera(width, height) {
146
152
  }
147
153
  function initLight() {
148
154
  const lights = new Group();
149
- const hemisphereLight = new HemisphereLight(16777215, 16777215, 2);
150
- hemisphereLight.intensity = 1;
151
- hemisphereLight.position.set(0, 0, 10);
152
- hemisphereLight.up.set(0, 0, 1);
153
- lights.add(hemisphereLight);
154
- const ambientLight = new AmbientLight(16777215, 1);
155
+ const ambientLight = new AmbientLight(16777215, 2.6);
155
156
  lights.add(ambientLight);
156
157
  return lights;
157
158
  }
@@ -176,7 +177,7 @@ function initDirectionalLight(color = 16777215, intensity = 1) {
176
177
  directionalLight.castShadow = true;
177
178
  directionalLight.shadow.radius = 8;
178
179
  directionalLight.shadow.bias = -1e-3;
179
- directionalLight.shadow.mapSize.set(128, 128);
180
+ directionalLight.shadow.mapSize.set(256, 256);
180
181
  directionalLight.shadow.camera.left = -200;
181
182
  directionalLight.shadow.camera.right = 200;
182
183
  directionalLight.shadow.camera.top = 200;
@@ -376,6 +377,16 @@ function sleepOnePromise() {
376
377
  function strToNumber(str) {
377
378
  return parseInt(str.replace("#", "0x"), 16);
378
379
  }
380
+ function addAlphaToHexColor(hexColor, alpha) {
381
+ let r = parseInt(hexColor.substring(1, 3), 16);
382
+ let g = parseInt(hexColor.substring(3, 5), 16);
383
+ let b = parseInt(hexColor.substring(5, 7), 16);
384
+ let newR = Math.round(r * alpha);
385
+ let newG = Math.round(g * alpha);
386
+ let newB = Math.round(b * alpha);
387
+ let newHexColor = `#${(1 << 24 | newR << 16 | newG << 8 | newB).toString(16).slice(1)}`;
388
+ return newHexColor;
389
+ }
379
390
 
380
391
  // src/context.ts
381
392
  import {
@@ -397,17 +408,12 @@ import { EventDispatcher as EventDispatcher3 } from "three";
397
408
  import {
398
409
  Object3D,
399
410
  ExtrudeGeometry,
400
- MeshStandardMaterial,
401
411
  Mesh,
402
- Color as Color2,
403
412
  Box3,
404
- EdgesGeometry,
405
- Vector3
413
+ Vector3,
414
+ BufferGeometry,
415
+ LineSegments
406
416
  } from "three";
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";
411
417
  var defaultOptions = {
412
418
  id: "",
413
419
  // 图形id
@@ -428,7 +434,7 @@ var defaultOptions = {
428
434
  strokeOpacity: 1,
429
435
  // 描边透明度
430
436
  strokeWidth: 1,
431
- // 描边宽度
437
+ // 描边宽度
432
438
  doors: [],
433
439
  // 门配置
434
440
  locked: false,
@@ -440,7 +446,9 @@ var defaultOptions = {
440
446
  curveIndex: []
441
447
  },
442
448
  layerType: "",
443
- zIndex: 0
449
+ zIndex: 0,
450
+ stroke: true,
451
+ userData: {}
444
452
  };
445
453
  var Graphic = class extends Object3D {
446
454
  constructor(context, options) {
@@ -450,8 +458,10 @@ var Graphic = class extends Object3D {
450
458
  __publicField(this, "material");
451
459
  __publicField(this, "mesh");
452
460
  __publicField(this, "line");
461
+ __publicField(this, "lineMaterial");
462
+ __publicField(this, "lineGeometry");
453
463
  __publicField(this, "options");
454
- this.options = proxyOptions(merge({}, defaultOptions, options), this);
464
+ this.options = proxyOptions(__spreadValues(__spreadValues({}, defaultOptions), options), this);
455
465
  if (this.options.geometry.type === "point") {
456
466
  const [x, y] = this.options.geometry.cds;
457
467
  this.position.set(x, y, this.options.height + this.options.airHeight);
@@ -460,23 +470,24 @@ var Graphic = class extends Object3D {
460
470
  this.init();
461
471
  this.visible = this.options.visible;
462
472
  this.addEventListener("change-fillColor", ({ value }) => {
463
- this.material.color = new Color2(value);
473
+ this.initMaterial();
474
+ this.initMesh();
464
475
  });
465
476
  this.addEventListener("change-fillOpacity", ({ value }) => {
466
- this.material.opacity = value;
477
+ this.initMaterial();
478
+ this.initMesh();
467
479
  });
468
480
  this.addEventListener("change-height", ({ value }) => {
469
481
  this.dispose();
470
482
  this.init();
471
483
  });
472
484
  this.addEventListener("change-strokeColor", ({ value }) => {
473
- this.line.material.color = new Color2(value);
485
+ this.initLineMaterial();
486
+ this.createBorder();
474
487
  });
475
488
  this.addEventListener("change-strokeOpacity", ({ value }) => {
476
- this.line.material.opacity = value;
477
- });
478
- this.addEventListener("change-strokeWidth", ({ value }) => {
479
- this.line.material.linewidth = value;
489
+ this.initLineMaterial();
490
+ this.createBorder();
480
491
  });
481
492
  this.addEventListener("change-airHeight", ({ value }) => {
482
493
  this.position.z = value;
@@ -484,6 +495,20 @@ var Graphic = class extends Object3D {
484
495
  this.addEventListener("change-visible", ({ value }) => {
485
496
  this.visible = value;
486
497
  });
498
+ this.addEventListener("change-stroke", ({ value }) => {
499
+ var _a;
500
+ if (value) {
501
+ if (this.line) {
502
+ return;
503
+ }
504
+ this.initLineGeometry();
505
+ this.initLineMaterial();
506
+ this.createBorder();
507
+ } else if (this.line) {
508
+ this.remove(this.line);
509
+ (_a = this.lineGeometry) == null ? void 0 : _a.dispose();
510
+ }
511
+ });
487
512
  }
488
513
  getCenter() {
489
514
  if (this.options.geometry.type === "point") {
@@ -512,13 +537,14 @@ var Graphic = class extends Object3D {
512
537
  }
513
538
  init() {
514
539
  this.geometry = this.initGeometry();
515
- this.material = this.initMaterial();
516
- this.mesh = this.initMesh();
540
+ this.initMaterial();
541
+ this.initMesh();
517
542
  this.mesh.position.z = this.options.airHeight;
518
- this.mesh.castShadow = true;
519
- this.add(this.mesh);
520
- this.line = this.createBorder();
521
- this.add(this.line);
543
+ if (this.options.stroke) {
544
+ this.initLineMaterial();
545
+ this.initLineGeometry();
546
+ this.createBorder();
547
+ }
522
548
  }
523
549
  initGeometry() {
524
550
  const shape = initShape(
@@ -534,39 +560,59 @@ var Graphic = class extends Object3D {
534
560
  return geometry;
535
561
  }
536
562
  initMaterial() {
537
- const material = new MeshStandardMaterial({
563
+ const material = this.context.materialFactory.createMeshStandardMaterial({
538
564
  color: this.options.fillColor,
539
- roughness: 1,
540
- transparent: true,
541
- opacity: this.options.fillOpacity,
542
- depthWrite: true
565
+ opacity: this.options.fillOpacity
543
566
  });
567
+ this.material = material;
544
568
  return material;
545
569
  }
546
570
  initLineMaterial() {
547
- const lineMaterial = new LineMaterial({
548
- color: new Color2(this.options.strokeColor).getHex(),
549
- opacity: this.options.strokeOpacity,
550
- transparent: true,
551
- depthWrite: true,
552
- linewidth: this.options.strokeWidth,
553
- wireframe: false,
554
- dashed: false
571
+ const lineMaterial = this.context.materialFactory.createLineMaterial({
572
+ color: this.options.strokeColor,
573
+ opacity: this.options.strokeOpacity
555
574
  });
556
- const { clientSize: { width, height } } = this.context;
557
- lineMaterial.resolution.set(width, height);
575
+ this.lineMaterial = lineMaterial;
558
576
  return lineMaterial;
559
577
  }
560
578
  initMesh() {
561
- return new Mesh(this.geometry, this.material);
579
+ if (this.mesh) {
580
+ this.remove(this.mesh);
581
+ }
582
+ this.mesh = new Mesh(this.geometry, this.material);
583
+ this.add(this.mesh);
584
+ }
585
+ getBorderPoints() {
586
+ const points = [];
587
+ const height = this.options.height;
588
+ const { cds, curveIndex } = this.options.geometry;
589
+ for (let j = 0; j < cds.length; j++) {
590
+ const curCds = cds[j];
591
+ for (let i = 0; i < curCds.length; i++) {
592
+ const cur = curCds[i];
593
+ const next = i + 1 === curCds.length ? curCds[0] : curCds[i + 1];
594
+ points.push(new Vector3(cur[0], cur[1], height));
595
+ points.push(new Vector3(next[0], next[1], height));
596
+ }
597
+ }
598
+ return points;
599
+ }
600
+ initLineGeometry() {
601
+ if (this.lineGeometry) {
602
+ this.lineGeometry.dispose();
603
+ }
604
+ const points = this.getBorderPoints();
605
+ const lineGeometry = new BufferGeometry().setFromPoints(points);
606
+ this.lineGeometry = lineGeometry;
562
607
  }
563
608
  createBorder() {
564
- const material = this.initLineMaterial();
565
- const geometry = new EdgesGeometry(this.geometry);
566
- const lineGeometry = new LineSegmentsGeometry();
567
- lineGeometry.fromEdgesGeometry(geometry);
568
- const line = new LineSegments2(lineGeometry, material);
569
- line.position.z = this.options.airHeight;
609
+ if (this.line) {
610
+ this.remove(this.line);
611
+ }
612
+ const line = new LineSegments(this.lineGeometry, this.lineMaterial);
613
+ line.position.z = this.options.airHeight + 0.01;
614
+ this.line = line;
615
+ this.add(line);
570
616
  return line;
571
617
  }
572
618
  raycast(raycaster) {
@@ -584,7 +630,9 @@ var Graphic = class extends Object3D {
584
630
  return false;
585
631
  }
586
632
  dispose() {
587
- dispose(this);
633
+ var _a;
634
+ this.geometry.dispose();
635
+ (_a = this.line) == null ? void 0 : _a.geometry.dispose();
588
636
  this.clear();
589
637
  }
590
638
  };
@@ -595,7 +643,7 @@ import {
595
643
  PlaneGeometry,
596
644
  Mesh as Mesh2,
597
645
  ShadowMaterial,
598
- Color as Color3,
646
+ Color as Color2,
599
647
  DoubleSide
600
648
  } from "three";
601
649
  var Shadow = class extends Object3D2 {
@@ -603,13 +651,13 @@ var Shadow = class extends Object3D2 {
603
651
  super();
604
652
  __publicField(this, "directionalLight");
605
653
  __publicField(this, "plane");
606
- __publicField(this, "basicOpacity", 0.15);
654
+ __publicField(this, "basicOpacity", 0.07);
607
655
  this.directionalLight = this.initLight();
608
656
  this.initPlane();
609
657
  }
610
658
  // 创建光源
611
659
  initLight() {
612
- const directionalLight = initDirectionalLight(16777215, 1);
660
+ const directionalLight = initDirectionalLight(16777215, 0.5);
613
661
  directionalLight.position.set(0, 0, 100);
614
662
  this.add(directionalLight);
615
663
  return directionalLight;
@@ -625,7 +673,7 @@ var Shadow = class extends Object3D2 {
625
673
  this.directionalLight.shadow.camera.far = Math.max(x, y);
626
674
  }
627
675
  changeLightColor(color) {
628
- this.directionalLight.color = new Color3(color);
676
+ this.directionalLight.color = new Color2(color);
629
677
  }
630
678
  setPosition(position) {
631
679
  this.position.copy(position);
@@ -662,7 +710,6 @@ var Shadow = class extends Object3D2 {
662
710
 
663
711
  // src/elements/poi.ts
664
712
  import { Object3D as Object3D4 } from "three";
665
- import { merge as merge2 } from "lodash";
666
713
 
667
714
  // src/elements/overlay.ts
668
715
  import { Box3 as Box32, EventDispatcher, Vector3 as Vector33 } from "three";
@@ -745,7 +792,7 @@ var Overlay = class extends EventDispatcher {
745
792
 
746
793
  // src/elements/poi.ts
747
794
  var defaultOptions2 = {
748
- text: "",
795
+ texts: [{ text: "" }],
749
796
  level: 1,
750
797
  collision_enable: true,
751
798
  opacity: 1,
@@ -765,7 +812,7 @@ var Poi = class extends Object3D4 {
765
812
  __publicField(this, "_changePosition", () => {
766
813
  this.overlay.div.style.transform = `translate3d(-50%, ${this.options.icon ? "-100%" : "-50%"}, 0)`;
767
814
  });
768
- this.options = proxyOptions(merge2({}, defaultOptions2, options), this);
815
+ this.options = proxyOptions(__spreadValues(__spreadValues({}, defaultOptions2), options), this);
769
816
  this.position.set(((_a = options.position) == null ? void 0 : _a.x) || 0, ((_b = options.position) == null ? void 0 : _b.y) || 0, ((_c = options.position) == null ? void 0 : _c.z) || 0);
770
817
  this.overlay = new Overlay(this.context);
771
818
  this.overlay.bindElement(this);
@@ -784,7 +831,7 @@ var Poi = class extends Object3D4 {
784
831
  this.resetSize();
785
832
  }
786
833
  });
787
- this.addEventListener("change-text", ({ value }) => {
834
+ this.addEventListener("change-texts", ({ value }) => {
788
835
  this.overlay.div.removeChild(this.textDiv);
789
836
  this.overlay.div.appendChild(this.initText());
790
837
  this.resetSize();
@@ -828,6 +875,7 @@ var Poi = class extends Object3D4 {
828
875
  div.appendChild(this.initIcon());
829
876
  }
830
877
  div.style.fontSize = `12px`;
878
+ div.style.textShadow = `#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0`;
831
879
  div.style.display = `flex`;
832
880
  div.style.flexDirection = `column`;
833
881
  div.style.justifyContent = `center`;
@@ -844,18 +892,27 @@ var Poi = class extends Object3D4 {
844
892
  initText() {
845
893
  const textDiv = document.createElement("div");
846
894
  textDiv.appendChild(this.createTextFragment());
847
- textDiv.style.background = "rgba(255, 255, 255, .7)";
848
- textDiv.style.padding = "2px";
849
- textDiv.style.borderRadius = "4px";
895
+ if (this.options.texts.length > 1) {
896
+ textDiv.style.background = "rgba(255, 255, 255, .7)";
897
+ textDiv.style.padding = "2px 4px";
898
+ textDiv.style.borderRadius = "4px";
899
+ textDiv.style.fontSize = "12px";
900
+ textDiv.style.lineHeight = "16px";
901
+ }
850
902
  this.textDiv = textDiv;
851
903
  return textDiv;
852
904
  }
853
905
  createTextFragment() {
854
906
  const f = document.createDocumentFragment();
855
- this.options.text.split("\r\n").forEach((item) => {
907
+ this.options.texts.forEach((item) => {
856
908
  const div = document.createElement("div");
857
909
  div.style.whiteSpace = "nowrap";
858
- div.textContent = item;
910
+ if (item.styles) {
911
+ for (let [key, value] of Object.entries(item.styles)) {
912
+ div.style[key] = value;
913
+ }
914
+ }
915
+ div.textContent = item.text;
859
916
  f.appendChild(div);
860
917
  });
861
918
  return f;
@@ -1234,7 +1291,8 @@ var Floor = class extends Object3D7 {
1234
1291
  addGrounds(grounds) {
1235
1292
  grounds.forEach((ground) => {
1236
1293
  if (!this.grounds.has(ground)) {
1237
- ground.options.height += ground.options.zIndex / 1e5;
1294
+ ground.options.height += ground.options.zIndex / 1e4;
1295
+ ground.mesh.castShadow = true;
1238
1296
  this.grounds.add(ground);
1239
1297
  this.groundUpper.add(ground);
1240
1298
  }
@@ -1261,7 +1319,7 @@ var Floor = class extends Object3D7 {
1261
1319
  this.add(this.shadow);
1262
1320
  }
1263
1321
  addGraphic(graphicOptions) {
1264
- graphicOptions.height += (graphicOptions.height || 0) / 1e5;
1322
+ graphicOptions.height += this.graphicLayer.graphicMap.size * 1e-5;
1265
1323
  return this.graphicLayer.createGraphic(graphicOptions);
1266
1324
  }
1267
1325
  addPoi(poiOptions) {
@@ -1990,6 +2048,53 @@ var HoverHelper = class extends EventDispatcher4 {
1990
2048
  }
1991
2049
  };
1992
2050
 
2051
+ // src/factory/material.ts
2052
+ import { LineBasicMaterial as LineBasicMaterial2, MeshStandardMaterial as MeshStandardMaterial3 } from "three";
2053
+ var MaterialFactory = class {
2054
+ constructor(context) {
2055
+ this.context = context;
2056
+ __publicField(this, "lineMaterialMap", /* @__PURE__ */ new Map());
2057
+ __publicField(this, "meshStandardMaterialMap", /* @__PURE__ */ new Map());
2058
+ }
2059
+ generateLineMaterialKey({ color, opacity }) {
2060
+ return `${color}-${opacity}`;
2061
+ }
2062
+ createLineMaterial({ color, opacity }) {
2063
+ const key = this.generateLineMaterialKey({ color, opacity });
2064
+ if (this.lineMaterialMap.has(key)) {
2065
+ return this.lineMaterialMap.get(key);
2066
+ }
2067
+ const lineMaterial = new LineBasicMaterial2({
2068
+ color,
2069
+ transparent: true,
2070
+ opacity
2071
+ });
2072
+ this.lineMaterialMap.set(key, lineMaterial);
2073
+ return lineMaterial;
2074
+ }
2075
+ createMeshStandardMaterial({ color, opacity }) {
2076
+ const key = `${color}-${opacity}`;
2077
+ if (this.meshStandardMaterialMap.has(key)) {
2078
+ return this.meshStandardMaterialMap.get(key);
2079
+ }
2080
+ const material = new MeshStandardMaterial3({
2081
+ color,
2082
+ roughness: 1,
2083
+ transparent: true,
2084
+ opacity,
2085
+ depthWrite: true
2086
+ });
2087
+ this.meshStandardMaterialMap.set(key, material);
2088
+ return material;
2089
+ }
2090
+ dispose() {
2091
+ this.lineMaterialMap.forEach((val, _) => {
2092
+ val.dispose();
2093
+ });
2094
+ this.lineMaterialMap.clear();
2095
+ }
2096
+ };
2097
+
1993
2098
  // src/context.ts
1994
2099
  var Context = class extends EventDispatcher5 {
1995
2100
  constructor(container, config) {
@@ -2009,6 +2114,7 @@ var Context = class extends EventDispatcher5 {
2009
2114
  __publicField(this, "hoverHelper");
2010
2115
  __publicField(this, "basicRatio");
2011
2116
  // zoom=1的时候,100M对应的像素个数
2117
+ __publicField(this, "materialFactory");
2012
2118
  __publicField(this, "clientSize", {
2013
2119
  width: 0,
2014
2120
  height: 0
@@ -2062,6 +2168,7 @@ var Context = class extends EventDispatcher5 {
2062
2168
  this.init();
2063
2169
  this.selection = new Selection(this);
2064
2170
  this.hoverHelper = new HoverHelper(this);
2171
+ this.materialFactory = new MaterialFactory(this);
2065
2172
  this.resizeClientSize();
2066
2173
  this.registryEvent();
2067
2174
  }
@@ -2207,6 +2314,7 @@ var Context = class extends EventDispatcher5 {
2207
2314
  this.control.update();
2208
2315
  this.control.maxAzimuthAngle = Infinity;
2209
2316
  this.control.minAzimuthAngle = Infinity;
2317
+ return;
2210
2318
  }
2211
2319
  return timeoutPromise(
2212
2320
  new Promise((resolve) => {
@@ -2245,9 +2353,11 @@ var Context = class extends EventDispatcher5 {
2245
2353
  target: this.control.target.clone()
2246
2354
  };
2247
2355
  if (!duration) {
2248
- this.camera.position.copy(start.target.clone().sub(lookAtVector));
2249
- this.control.target.copy(start.target);
2250
- this.camera.zoom = start.zoom;
2356
+ this.camera.position.copy(center2.clone().sub(lookAtVector));
2357
+ this.control.target.copy(center2);
2358
+ this.camera.zoom = zoom;
2359
+ this.control.update();
2360
+ return;
2251
2361
  }
2252
2362
  return timeoutPromise(
2253
2363
  new Promise((resolve) => {
@@ -2353,12 +2463,13 @@ var Context = class extends EventDispatcher5 {
2353
2463
  this.lights.children.forEach(
2354
2464
  (light) => light.dispose()
2355
2465
  );
2466
+ this.materialFactory.dispose();
2356
2467
  dispose(this.scene);
2357
2468
  }
2358
2469
  };
2359
2470
 
2360
2471
  // src/config.ts
2361
- import { merge as merge3 } from "lodash";
2472
+ import { merge } from "lodash";
2362
2473
  var defaultConfig = {
2363
2474
  apiDomain: "",
2364
2475
  apiInfo: {},
@@ -2376,7 +2487,8 @@ var defaultConfig = {
2376
2487
  },
2377
2488
  useFloorCache: true,
2378
2489
  control: {
2379
- maxPolar: 0.9
2490
+ maxPolar: 1.2,
2491
+ defaultPolar: 0.9
2380
2492
  },
2381
2493
  svg: {
2382
2494
  circle: {
@@ -2393,10 +2505,26 @@ var defaultConfig = {
2393
2505
  },
2394
2506
  hover: {
2395
2507
  time: 500
2508
+ },
2509
+ ground: {
2510
+ color: "#ffffff",
2511
+ opacity: 1,
2512
+ height: 5,
2513
+ stroke: true,
2514
+ strokeColor: "#E6E6E6",
2515
+ strokeOpacity: 1
2516
+ },
2517
+ markGraphic: {
2518
+ color: "#ecf0f7",
2519
+ opacity: 1,
2520
+ height: 1e-3,
2521
+ stroke: false,
2522
+ strokeColor: "#000",
2523
+ strokeOpacity: 1
2396
2524
  }
2397
2525
  };
2398
2526
  function getConfig(config) {
2399
- return merge3({}, defaultConfig, config);
2527
+ return merge({}, defaultConfig, config);
2400
2528
  }
2401
2529
 
2402
2530
  // src/bmap.ts
@@ -2526,6 +2654,26 @@ var BMap = class extends EventDispatcher6 {
2526
2654
  item.info.transformToBuildingGround = true;
2527
2655
  });
2528
2656
  }
2657
+ const { ground, markGraphic } = this.config;
2658
+ for (const item of data) {
2659
+ if (item.info.group === "ground") {
2660
+ item.info.fillColor = ground.color;
2661
+ item.info.fillOpacity = ground.opacity;
2662
+ item.info.height = ground.height;
2663
+ item.info.stroke = ground.stroke;
2664
+ item.info.strokeColor = ground.strokeColor;
2665
+ item.info.strokeOpacity = ground.strokeOpacity;
2666
+ } else {
2667
+ if (item.info.userData.mark) {
2668
+ item.info.height = markGraphic.height;
2669
+ item.info.fillColor = markGraphic.color;
2670
+ item.info.fillOpacity = markGraphic.opacity;
2671
+ item.info.stroke = markGraphic.stroke;
2672
+ item.info.strokeColor = markGraphic.strokeColor;
2673
+ item.info.strokeOpacity = markGraphic.strokeOpacity;
2674
+ }
2675
+ }
2676
+ }
2529
2677
  if (!this.config.useFloorCache) {
2530
2678
  this.floorDataMap.clear();
2531
2679
  }
@@ -2538,26 +2686,18 @@ var BMap = class extends EventDispatcher6 {
2538
2686
  if (!data.length) {
2539
2687
  return { curFloor, graphics: [] };
2540
2688
  }
2541
- const grounds = data.filter((item) => item.info.group === "ground");
2542
- grounds.forEach((item) => {
2543
- item.info.fillColor = "#F5F7F9";
2544
- item.info.fillOpacity = 1;
2545
- item.info.strokeOpacity = 0;
2546
- item.info.height = 5;
2547
- });
2548
- const groundGraphics = grounds.map((ground) => new Graphic(this.context, ground.info));
2549
- curFloor.addGrounds(groundGraphics);
2550
- const graphicData = data.filter((item) => item.info.group !== "ground");
2551
- graphicData.forEach((item, index) => {
2552
- item.info.height = 5;
2553
- });
2554
2689
  const legacyToGraphicMap = /* @__PURE__ */ new Map();
2555
- const graphics = graphicData.map((item) => {
2556
- const graphic = curFloor.addGraphic(item.info);
2557
- graphic.userData.data = item;
2558
- legacyToGraphicMap.set(item.legacy_id, graphic);
2559
- return graphic;
2560
- });
2690
+ const graphics = [];
2691
+ for (const item of data) {
2692
+ if (item.info.group === "ground") {
2693
+ curFloor.addGrounds([new Graphic(this.context, item.info)]);
2694
+ } else {
2695
+ const graphic = curFloor.addGraphic(item.info);
2696
+ graphic.userData.data = item;
2697
+ legacyToGraphicMap.set(item.legacy_id, graphic);
2698
+ graphics.push(graphic);
2699
+ }
2700
+ }
2561
2701
  curFloor.addShadow();
2562
2702
  curFloor.userData.legacyToGraphicMap = legacyToGraphicMap;
2563
2703
  return { curFloor, graphics };
@@ -2574,6 +2714,7 @@ var BMap = class extends EventDispatcher6 {
2574
2714
  this.context.switchFloor(createdFloor.curFloor);
2575
2715
  this.context.control.minZoom = 0;
2576
2716
  this.context.control.maxZoom = Infinity;
2717
+ this.context.camera.zoom = 1;
2577
2718
  this.context.setAzimuthalAngle(0, 0);
2578
2719
  this.context.fitCameraToGround(void 0, 0);
2579
2720
  this.basicZoom = this.context.camera.zoom;
@@ -2833,6 +2974,8 @@ var BMap = class extends EventDispatcher6 {
2833
2974
  }
2834
2975
  dispose() {
2835
2976
  this.context.dispose();
2977
+ this.floorDataMap.clear();
2978
+ this.buildingGroundMap.clear();
2836
2979
  clearTextTexture();
2837
2980
  clearCanvas();
2838
2981
  this.unRegistryEvent();
@@ -2858,6 +3001,7 @@ export {
2858
3001
  SvgLine,
2859
3002
  SvgPolygon,
2860
3003
  Timer,
3004
+ addAlphaToHexColor,
2861
3005
  clearCanvas,
2862
3006
  clearTextTexture,
2863
3007
  createCanvas,