@aibee/crc-bmap 0.0.47 → 0.0.49
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/example/src/main.ts +14 -9
- package/example/vite.config.ts +2 -1
- package/lib/bmap.cjs.min.js +1 -1
- package/lib/bmap.cjs.min.js.map +4 -4
- package/lib/bmap.esm.js +202 -88
- package/lib/bmap.esm.js.map +4 -4
- package/lib/bmap.esm.min.js +1 -1
- package/lib/bmap.esm.min.js.map +4 -4
- package/lib/bmap.min.js +1 -1
- package/lib/bmap.min.js.map +4 -4
- package/lib/src/config.d.ts +17 -0
- package/lib/src/context.d.ts +3 -1
- package/lib/src/elements/graphic.d.ts +8 -7
- package/lib/src/factory/index.d.ts +1 -0
- package/lib/src/factory/material.d.ts +21 -0
- package/lib/src/types/index.d.ts +2 -0
- package/lib/src/utils/color.d.ts +7 -0
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -128,7 +128,14 @@ function initScene() {
|
|
|
128
128
|
return scene;
|
|
129
129
|
}
|
|
130
130
|
function initRenderer() {
|
|
131
|
-
const renderer = new WebGLRenderer({
|
|
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);
|
|
132
139
|
renderer.setClearColor(16777215);
|
|
133
140
|
renderer.setPixelRatio(window.devicePixelRatio);
|
|
134
141
|
renderer.shadowMap.enabled = true;
|
|
@@ -370,6 +377,16 @@ function sleepOnePromise() {
|
|
|
370
377
|
function strToNumber(str) {
|
|
371
378
|
return parseInt(str.replace("#", "0x"), 16);
|
|
372
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
|
+
}
|
|
373
390
|
|
|
374
391
|
// src/context.ts
|
|
375
392
|
import {
|
|
@@ -391,16 +408,12 @@ import { EventDispatcher as EventDispatcher3 } from "three";
|
|
|
391
408
|
import {
|
|
392
409
|
Object3D,
|
|
393
410
|
ExtrudeGeometry,
|
|
394
|
-
MeshStandardMaterial,
|
|
395
411
|
Mesh,
|
|
396
|
-
Color as Color2,
|
|
397
412
|
Box3,
|
|
398
|
-
Vector3
|
|
413
|
+
Vector3,
|
|
414
|
+
BufferGeometry,
|
|
415
|
+
LineSegments
|
|
399
416
|
} from "three";
|
|
400
|
-
import { merge } from "lodash";
|
|
401
|
-
import { LineMaterial } from "three/examples/jsm/lines/LineMaterial.js";
|
|
402
|
-
import { LineSegmentsGeometry } from "three/examples/jsm/lines/LineSegmentsGeometry.js";
|
|
403
|
-
import { LineSegments2 } from "three/examples/jsm/lines/LineSegments2.js";
|
|
404
417
|
var defaultOptions = {
|
|
405
418
|
id: "",
|
|
406
419
|
// 图形id
|
|
@@ -433,7 +446,9 @@ var defaultOptions = {
|
|
|
433
446
|
curveIndex: []
|
|
434
447
|
},
|
|
435
448
|
layerType: "",
|
|
436
|
-
zIndex: 0
|
|
449
|
+
zIndex: 0,
|
|
450
|
+
stroke: true,
|
|
451
|
+
userData: {}
|
|
437
452
|
};
|
|
438
453
|
var Graphic = class extends Object3D {
|
|
439
454
|
constructor(context, options) {
|
|
@@ -443,8 +458,10 @@ var Graphic = class extends Object3D {
|
|
|
443
458
|
__publicField(this, "material");
|
|
444
459
|
__publicField(this, "mesh");
|
|
445
460
|
__publicField(this, "line");
|
|
461
|
+
__publicField(this, "lineMaterial");
|
|
462
|
+
__publicField(this, "lineGeometry");
|
|
446
463
|
__publicField(this, "options");
|
|
447
|
-
this.options = proxyOptions(
|
|
464
|
+
this.options = proxyOptions(__spreadValues(__spreadValues({}, defaultOptions), options), this);
|
|
448
465
|
if (this.options.geometry.type === "point") {
|
|
449
466
|
const [x, y] = this.options.geometry.cds;
|
|
450
467
|
this.position.set(x, y, this.options.height + this.options.airHeight);
|
|
@@ -453,23 +470,30 @@ var Graphic = class extends Object3D {
|
|
|
453
470
|
this.init();
|
|
454
471
|
this.visible = this.options.visible;
|
|
455
472
|
this.addEventListener("change-fillColor", ({ value }) => {
|
|
456
|
-
this.
|
|
473
|
+
this.initMaterial();
|
|
474
|
+
this.initMesh();
|
|
457
475
|
});
|
|
458
476
|
this.addEventListener("change-fillOpacity", ({ value }) => {
|
|
459
|
-
this.
|
|
477
|
+
this.initMaterial();
|
|
478
|
+
this.initMesh();
|
|
460
479
|
});
|
|
461
480
|
this.addEventListener("change-height", ({ value }) => {
|
|
462
481
|
this.dispose();
|
|
463
482
|
this.init();
|
|
464
483
|
});
|
|
465
484
|
this.addEventListener("change-strokeColor", ({ value }) => {
|
|
466
|
-
this.
|
|
485
|
+
if (!this.options.stroke) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
this.initLineMaterial();
|
|
489
|
+
this.createBorder();
|
|
467
490
|
});
|
|
468
491
|
this.addEventListener("change-strokeOpacity", ({ value }) => {
|
|
469
|
-
this.
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
this.
|
|
492
|
+
if (!this.options.stroke) {
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
this.initLineMaterial();
|
|
496
|
+
this.createBorder();
|
|
473
497
|
});
|
|
474
498
|
this.addEventListener("change-airHeight", ({ value }) => {
|
|
475
499
|
this.position.z = value;
|
|
@@ -477,6 +501,20 @@ var Graphic = class extends Object3D {
|
|
|
477
501
|
this.addEventListener("change-visible", ({ value }) => {
|
|
478
502
|
this.visible = value;
|
|
479
503
|
});
|
|
504
|
+
this.addEventListener("change-stroke", ({ value }) => {
|
|
505
|
+
var _a;
|
|
506
|
+
if (value) {
|
|
507
|
+
if (this.line) {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
this.initLineGeometry();
|
|
511
|
+
this.initLineMaterial();
|
|
512
|
+
this.createBorder();
|
|
513
|
+
} else if (this.line) {
|
|
514
|
+
this.remove(this.line);
|
|
515
|
+
(_a = this.lineGeometry) == null ? void 0 : _a.dispose();
|
|
516
|
+
}
|
|
517
|
+
});
|
|
480
518
|
}
|
|
481
519
|
getCenter() {
|
|
482
520
|
if (this.options.geometry.type === "point") {
|
|
@@ -505,13 +543,14 @@ var Graphic = class extends Object3D {
|
|
|
505
543
|
}
|
|
506
544
|
init() {
|
|
507
545
|
this.geometry = this.initGeometry();
|
|
508
|
-
this.
|
|
509
|
-
this.
|
|
546
|
+
this.initMaterial();
|
|
547
|
+
this.initMesh();
|
|
510
548
|
this.mesh.position.z = this.options.airHeight;
|
|
511
|
-
this.
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
549
|
+
if (this.options.stroke) {
|
|
550
|
+
this.initLineMaterial();
|
|
551
|
+
this.initLineGeometry();
|
|
552
|
+
this.createBorder();
|
|
553
|
+
}
|
|
515
554
|
}
|
|
516
555
|
initGeometry() {
|
|
517
556
|
const shape = initShape(
|
|
@@ -527,31 +566,27 @@ var Graphic = class extends Object3D {
|
|
|
527
566
|
return geometry;
|
|
528
567
|
}
|
|
529
568
|
initMaterial() {
|
|
530
|
-
const material =
|
|
569
|
+
const material = this.context.materialFactory.createMeshStandardMaterial({
|
|
531
570
|
color: this.options.fillColor,
|
|
532
|
-
|
|
533
|
-
transparent: true,
|
|
534
|
-
opacity: this.options.fillOpacity,
|
|
535
|
-
depthWrite: true
|
|
571
|
+
opacity: this.options.fillOpacity
|
|
536
572
|
});
|
|
573
|
+
this.material = material;
|
|
537
574
|
return material;
|
|
538
575
|
}
|
|
539
576
|
initLineMaterial() {
|
|
540
|
-
const lineMaterial =
|
|
541
|
-
color:
|
|
542
|
-
opacity: this.options.strokeOpacity
|
|
543
|
-
transparent: true,
|
|
544
|
-
depthWrite: true,
|
|
545
|
-
linewidth: this.options.strokeWidth,
|
|
546
|
-
wireframe: false,
|
|
547
|
-
dashed: false
|
|
577
|
+
const lineMaterial = this.context.materialFactory.createLineMaterial({
|
|
578
|
+
color: this.options.strokeColor,
|
|
579
|
+
opacity: this.options.strokeOpacity
|
|
548
580
|
});
|
|
549
|
-
|
|
550
|
-
lineMaterial.resolution.set(width, height);
|
|
581
|
+
this.lineMaterial = lineMaterial;
|
|
551
582
|
return lineMaterial;
|
|
552
583
|
}
|
|
553
584
|
initMesh() {
|
|
554
|
-
|
|
585
|
+
if (this.mesh) {
|
|
586
|
+
this.remove(this.mesh);
|
|
587
|
+
}
|
|
588
|
+
this.mesh = new Mesh(this.geometry, this.material);
|
|
589
|
+
this.add(this.mesh);
|
|
555
590
|
}
|
|
556
591
|
getBorderPoints() {
|
|
557
592
|
const points = [];
|
|
@@ -562,35 +597,28 @@ var Graphic = class extends Object3D {
|
|
|
562
597
|
for (let i = 0; i < curCds.length; i++) {
|
|
563
598
|
const cur = curCds[i];
|
|
564
599
|
const next = i + 1 === curCds.length ? curCds[0] : curCds[i + 1];
|
|
565
|
-
points.push(cur[0], cur[1],
|
|
566
|
-
points.push(next[0], next[1],
|
|
567
|
-
points.push(cur[0], cur[1], height);
|
|
568
|
-
points.push(next[0], next[1], height);
|
|
569
|
-
if (j > 0) {
|
|
570
|
-
points.push(cur[0], cur[1], 0);
|
|
571
|
-
points.push(cur[0], cur[1], height);
|
|
572
|
-
} else {
|
|
573
|
-
if (curveIndex.length) {
|
|
574
|
-
if (curveIndex.includes(i)) {
|
|
575
|
-
points.push(cur[0], cur[1], 0);
|
|
576
|
-
points.push(cur[0], cur[1], height);
|
|
577
|
-
}
|
|
578
|
-
} else {
|
|
579
|
-
points.push(cur[0], cur[1], 0);
|
|
580
|
-
points.push(cur[0], cur[1], height);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
600
|
+
points.push(new Vector3(cur[0], cur[1], height));
|
|
601
|
+
points.push(new Vector3(next[0], next[1], height));
|
|
583
602
|
}
|
|
584
603
|
}
|
|
585
604
|
return points;
|
|
586
605
|
}
|
|
587
|
-
|
|
588
|
-
|
|
606
|
+
initLineGeometry() {
|
|
607
|
+
if (this.lineGeometry) {
|
|
608
|
+
this.lineGeometry.dispose();
|
|
609
|
+
}
|
|
589
610
|
const points = this.getBorderPoints();
|
|
590
|
-
const lineGeometry = new
|
|
591
|
-
lineGeometry
|
|
592
|
-
|
|
593
|
-
|
|
611
|
+
const lineGeometry = new BufferGeometry().setFromPoints(points);
|
|
612
|
+
this.lineGeometry = lineGeometry;
|
|
613
|
+
}
|
|
614
|
+
createBorder() {
|
|
615
|
+
if (this.line) {
|
|
616
|
+
this.remove(this.line);
|
|
617
|
+
}
|
|
618
|
+
const line = new LineSegments(this.lineGeometry, this.lineMaterial);
|
|
619
|
+
line.position.z = this.options.airHeight + 0.01;
|
|
620
|
+
this.line = line;
|
|
621
|
+
this.add(line);
|
|
594
622
|
return line;
|
|
595
623
|
}
|
|
596
624
|
raycast(raycaster) {
|
|
@@ -608,7 +636,9 @@ var Graphic = class extends Object3D {
|
|
|
608
636
|
return false;
|
|
609
637
|
}
|
|
610
638
|
dispose() {
|
|
611
|
-
|
|
639
|
+
var _a;
|
|
640
|
+
this.geometry.dispose();
|
|
641
|
+
(_a = this.line) == null ? void 0 : _a.geometry.dispose();
|
|
612
642
|
this.clear();
|
|
613
643
|
}
|
|
614
644
|
};
|
|
@@ -619,7 +649,7 @@ import {
|
|
|
619
649
|
PlaneGeometry,
|
|
620
650
|
Mesh as Mesh2,
|
|
621
651
|
ShadowMaterial,
|
|
622
|
-
Color as
|
|
652
|
+
Color as Color2,
|
|
623
653
|
DoubleSide
|
|
624
654
|
} from "three";
|
|
625
655
|
var Shadow = class extends Object3D2 {
|
|
@@ -649,7 +679,7 @@ var Shadow = class extends Object3D2 {
|
|
|
649
679
|
this.directionalLight.shadow.camera.far = Math.max(x, y);
|
|
650
680
|
}
|
|
651
681
|
changeLightColor(color) {
|
|
652
|
-
this.directionalLight.color = new
|
|
682
|
+
this.directionalLight.color = new Color2(color);
|
|
653
683
|
}
|
|
654
684
|
setPosition(position) {
|
|
655
685
|
this.position.copy(position);
|
|
@@ -686,7 +716,6 @@ var Shadow = class extends Object3D2 {
|
|
|
686
716
|
|
|
687
717
|
// src/elements/poi.ts
|
|
688
718
|
import { Object3D as Object3D4 } from "three";
|
|
689
|
-
import { merge as merge2 } from "lodash";
|
|
690
719
|
|
|
691
720
|
// src/elements/overlay.ts
|
|
692
721
|
import { Box3 as Box32, EventDispatcher, Vector3 as Vector33 } from "three";
|
|
@@ -789,7 +818,7 @@ var Poi = class extends Object3D4 {
|
|
|
789
818
|
__publicField(this, "_changePosition", () => {
|
|
790
819
|
this.overlay.div.style.transform = `translate3d(-50%, ${this.options.icon ? "-100%" : "-50%"}, 0)`;
|
|
791
820
|
});
|
|
792
|
-
this.options = proxyOptions(
|
|
821
|
+
this.options = proxyOptions(__spreadValues(__spreadValues({}, defaultOptions2), options), this);
|
|
793
822
|
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);
|
|
794
823
|
this.overlay = new Overlay(this.context);
|
|
795
824
|
this.overlay.bindElement(this);
|
|
@@ -851,7 +880,7 @@ var Poi = class extends Object3D4 {
|
|
|
851
880
|
if (this.options.icon) {
|
|
852
881
|
div.appendChild(this.initIcon());
|
|
853
882
|
}
|
|
854
|
-
div.style.fontSize = `
|
|
883
|
+
div.style.fontSize = `12px`;
|
|
855
884
|
div.style.textShadow = `#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0`;
|
|
856
885
|
div.style.display = `flex`;
|
|
857
886
|
div.style.flexDirection = `column`;
|
|
@@ -1269,6 +1298,7 @@ var Floor = class extends Object3D7 {
|
|
|
1269
1298
|
grounds.forEach((ground) => {
|
|
1270
1299
|
if (!this.grounds.has(ground)) {
|
|
1271
1300
|
ground.options.height += ground.options.zIndex / 1e4;
|
|
1301
|
+
ground.mesh.castShadow = true;
|
|
1272
1302
|
this.grounds.add(ground);
|
|
1273
1303
|
this.groundUpper.add(ground);
|
|
1274
1304
|
}
|
|
@@ -2024,6 +2054,53 @@ var HoverHelper = class extends EventDispatcher4 {
|
|
|
2024
2054
|
}
|
|
2025
2055
|
};
|
|
2026
2056
|
|
|
2057
|
+
// src/factory/material.ts
|
|
2058
|
+
import { LineBasicMaterial as LineBasicMaterial2, MeshStandardMaterial as MeshStandardMaterial3 } from "three";
|
|
2059
|
+
var MaterialFactory = class {
|
|
2060
|
+
constructor(context) {
|
|
2061
|
+
this.context = context;
|
|
2062
|
+
__publicField(this, "lineMaterialMap", /* @__PURE__ */ new Map());
|
|
2063
|
+
__publicField(this, "meshStandardMaterialMap", /* @__PURE__ */ new Map());
|
|
2064
|
+
}
|
|
2065
|
+
generateLineMaterialKey({ color, opacity }) {
|
|
2066
|
+
return `${color}-${opacity}`;
|
|
2067
|
+
}
|
|
2068
|
+
createLineMaterial({ color, opacity }) {
|
|
2069
|
+
const key = this.generateLineMaterialKey({ color, opacity });
|
|
2070
|
+
if (this.lineMaterialMap.has(key)) {
|
|
2071
|
+
return this.lineMaterialMap.get(key);
|
|
2072
|
+
}
|
|
2073
|
+
const lineMaterial = new LineBasicMaterial2({
|
|
2074
|
+
color,
|
|
2075
|
+
transparent: true,
|
|
2076
|
+
opacity
|
|
2077
|
+
});
|
|
2078
|
+
this.lineMaterialMap.set(key, lineMaterial);
|
|
2079
|
+
return lineMaterial;
|
|
2080
|
+
}
|
|
2081
|
+
createMeshStandardMaterial({ color, opacity }) {
|
|
2082
|
+
const key = `${color}-${opacity}`;
|
|
2083
|
+
if (this.meshStandardMaterialMap.has(key)) {
|
|
2084
|
+
return this.meshStandardMaterialMap.get(key);
|
|
2085
|
+
}
|
|
2086
|
+
const material = new MeshStandardMaterial3({
|
|
2087
|
+
color,
|
|
2088
|
+
roughness: 1,
|
|
2089
|
+
transparent: true,
|
|
2090
|
+
opacity,
|
|
2091
|
+
depthWrite: true
|
|
2092
|
+
});
|
|
2093
|
+
this.meshStandardMaterialMap.set(key, material);
|
|
2094
|
+
return material;
|
|
2095
|
+
}
|
|
2096
|
+
dispose() {
|
|
2097
|
+
this.lineMaterialMap.forEach((val, _) => {
|
|
2098
|
+
val.dispose();
|
|
2099
|
+
});
|
|
2100
|
+
this.lineMaterialMap.clear();
|
|
2101
|
+
}
|
|
2102
|
+
};
|
|
2103
|
+
|
|
2027
2104
|
// src/context.ts
|
|
2028
2105
|
var Context = class extends EventDispatcher5 {
|
|
2029
2106
|
constructor(container, config) {
|
|
@@ -2043,6 +2120,7 @@ var Context = class extends EventDispatcher5 {
|
|
|
2043
2120
|
__publicField(this, "hoverHelper");
|
|
2044
2121
|
__publicField(this, "basicRatio");
|
|
2045
2122
|
// zoom=1的时候,100M对应的像素个数
|
|
2123
|
+
__publicField(this, "materialFactory");
|
|
2046
2124
|
__publicField(this, "clientSize", {
|
|
2047
2125
|
width: 0,
|
|
2048
2126
|
height: 0
|
|
@@ -2096,6 +2174,7 @@ var Context = class extends EventDispatcher5 {
|
|
|
2096
2174
|
this.init();
|
|
2097
2175
|
this.selection = new Selection(this);
|
|
2098
2176
|
this.hoverHelper = new HoverHelper(this);
|
|
2177
|
+
this.materialFactory = new MaterialFactory(this);
|
|
2099
2178
|
this.resizeClientSize();
|
|
2100
2179
|
this.registryEvent();
|
|
2101
2180
|
}
|
|
@@ -2241,6 +2320,7 @@ var Context = class extends EventDispatcher5 {
|
|
|
2241
2320
|
this.control.update();
|
|
2242
2321
|
this.control.maxAzimuthAngle = Infinity;
|
|
2243
2322
|
this.control.minAzimuthAngle = Infinity;
|
|
2323
|
+
return;
|
|
2244
2324
|
}
|
|
2245
2325
|
return timeoutPromise(
|
|
2246
2326
|
new Promise((resolve) => {
|
|
@@ -2389,12 +2469,13 @@ var Context = class extends EventDispatcher5 {
|
|
|
2389
2469
|
this.lights.children.forEach(
|
|
2390
2470
|
(light) => light.dispose()
|
|
2391
2471
|
);
|
|
2472
|
+
this.materialFactory.dispose();
|
|
2392
2473
|
dispose(this.scene);
|
|
2393
2474
|
}
|
|
2394
2475
|
};
|
|
2395
2476
|
|
|
2396
2477
|
// src/config.ts
|
|
2397
|
-
import { merge
|
|
2478
|
+
import { merge } from "lodash";
|
|
2398
2479
|
var defaultConfig = {
|
|
2399
2480
|
apiDomain: "",
|
|
2400
2481
|
apiInfo: {},
|
|
@@ -2412,7 +2493,8 @@ var defaultConfig = {
|
|
|
2412
2493
|
},
|
|
2413
2494
|
useFloorCache: true,
|
|
2414
2495
|
control: {
|
|
2415
|
-
maxPolar:
|
|
2496
|
+
maxPolar: 1.2,
|
|
2497
|
+
defaultPolar: 0.9
|
|
2416
2498
|
},
|
|
2417
2499
|
svg: {
|
|
2418
2500
|
circle: {
|
|
@@ -2429,10 +2511,26 @@ var defaultConfig = {
|
|
|
2429
2511
|
},
|
|
2430
2512
|
hover: {
|
|
2431
2513
|
time: 500
|
|
2514
|
+
},
|
|
2515
|
+
ground: {
|
|
2516
|
+
color: "#ffffff",
|
|
2517
|
+
opacity: 1,
|
|
2518
|
+
height: 5,
|
|
2519
|
+
stroke: true,
|
|
2520
|
+
strokeColor: "#E6E6E6",
|
|
2521
|
+
strokeOpacity: 1
|
|
2522
|
+
},
|
|
2523
|
+
markGraphic: {
|
|
2524
|
+
color: "#ecf0f7",
|
|
2525
|
+
opacity: 1,
|
|
2526
|
+
height: 1e-3,
|
|
2527
|
+
stroke: false,
|
|
2528
|
+
strokeColor: "#000",
|
|
2529
|
+
strokeOpacity: 1
|
|
2432
2530
|
}
|
|
2433
2531
|
};
|
|
2434
2532
|
function getConfig(config) {
|
|
2435
|
-
return
|
|
2533
|
+
return merge({}, defaultConfig, config);
|
|
2436
2534
|
}
|
|
2437
2535
|
|
|
2438
2536
|
// src/bmap.ts
|
|
@@ -2562,6 +2660,26 @@ var BMap = class extends EventDispatcher6 {
|
|
|
2562
2660
|
item.info.transformToBuildingGround = true;
|
|
2563
2661
|
});
|
|
2564
2662
|
}
|
|
2663
|
+
const { ground, markGraphic } = this.config;
|
|
2664
|
+
for (const item of data) {
|
|
2665
|
+
if (item.info.group === "ground") {
|
|
2666
|
+
item.info.fillColor = ground.color;
|
|
2667
|
+
item.info.fillOpacity = ground.opacity;
|
|
2668
|
+
item.info.height = ground.height;
|
|
2669
|
+
item.info.stroke = ground.stroke;
|
|
2670
|
+
item.info.strokeColor = ground.strokeColor;
|
|
2671
|
+
item.info.strokeOpacity = ground.strokeOpacity;
|
|
2672
|
+
} else {
|
|
2673
|
+
if (item.info.userData.mark) {
|
|
2674
|
+
item.info.height = markGraphic.height;
|
|
2675
|
+
item.info.fillColor = markGraphic.color;
|
|
2676
|
+
item.info.fillOpacity = markGraphic.opacity;
|
|
2677
|
+
item.info.stroke = markGraphic.stroke;
|
|
2678
|
+
item.info.strokeColor = markGraphic.strokeColor;
|
|
2679
|
+
item.info.strokeOpacity = markGraphic.strokeOpacity;
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2565
2683
|
if (!this.config.useFloorCache) {
|
|
2566
2684
|
this.floorDataMap.clear();
|
|
2567
2685
|
}
|
|
@@ -2574,23 +2692,18 @@ var BMap = class extends EventDispatcher6 {
|
|
|
2574
2692
|
if (!data.length) {
|
|
2575
2693
|
return { curFloor, graphics: [] };
|
|
2576
2694
|
}
|
|
2577
|
-
const grounds = data.filter((item) => item.info.group === "ground");
|
|
2578
|
-
grounds.forEach((item) => {
|
|
2579
|
-
item.info.fillColor = "#F2F6FC";
|
|
2580
|
-
item.info.fillOpacity = 1;
|
|
2581
|
-
item.info.strokeOpacity = 0;
|
|
2582
|
-
item.info.height = 5;
|
|
2583
|
-
});
|
|
2584
|
-
const groundGraphics = grounds.map((ground) => new Graphic(this.context, ground.info));
|
|
2585
|
-
curFloor.addGrounds(groundGraphics);
|
|
2586
|
-
const graphicData = data.filter((item) => item.info.group !== "ground");
|
|
2587
2695
|
const legacyToGraphicMap = /* @__PURE__ */ new Map();
|
|
2588
|
-
const graphics =
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2696
|
+
const graphics = [];
|
|
2697
|
+
for (const item of data) {
|
|
2698
|
+
if (item.info.group === "ground") {
|
|
2699
|
+
curFloor.addGrounds([new Graphic(this.context, item.info)]);
|
|
2700
|
+
} else {
|
|
2701
|
+
const graphic = curFloor.addGraphic(item.info);
|
|
2702
|
+
graphic.userData.data = item;
|
|
2703
|
+
legacyToGraphicMap.set(item.legacy_id, graphic);
|
|
2704
|
+
graphics.push(graphic);
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2594
2707
|
curFloor.addShadow();
|
|
2595
2708
|
curFloor.userData.legacyToGraphicMap = legacyToGraphicMap;
|
|
2596
2709
|
return { curFloor, graphics };
|
|
@@ -2894,6 +3007,7 @@ export {
|
|
|
2894
3007
|
SvgLine,
|
|
2895
3008
|
SvgPolygon,
|
|
2896
3009
|
Timer,
|
|
3010
|
+
addAlphaToHexColor,
|
|
2897
3011
|
clearCanvas,
|
|
2898
3012
|
clearTextTexture,
|
|
2899
3013
|
createCanvas,
|