@aibee/crc-bmap 0.0.37 → 0.0.39
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 +3 -0
- package/lib/bmap.cjs.min.js +2 -2
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +30 -16
- package/lib/bmap.esm.js.map +2 -2
- package/lib/bmap.esm.min.js +2 -2
- package/lib/bmap.esm.min.js.map +3 -3
- package/lib/bmap.min.js +2 -2
- package/lib/bmap.min.js.map +3 -3
- package/lib/src/bmap.d.ts +1 -1
- package/lib/src/elements/graphic.d.ts +5 -3
- package/lib/src/types/index.d.ts +1 -0
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -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
|
});
|
|
@@ -500,13 +506,15 @@ var Graphic = class extends Object3D {
|
|
|
500
506
|
return size;
|
|
501
507
|
}
|
|
502
508
|
getPosition() {
|
|
503
|
-
|
|
509
|
+
const center2 = this.getCenter();
|
|
510
|
+
center2.setZ(center2.z + this.options.height);
|
|
511
|
+
return center2;
|
|
504
512
|
}
|
|
505
513
|
init() {
|
|
506
514
|
this.geometry = this.initGeometry();
|
|
507
515
|
this.material = this.initMaterial();
|
|
508
516
|
this.mesh = this.initMesh();
|
|
509
|
-
this.mesh.position.z = this.options.airHeight
|
|
517
|
+
this.mesh.position.z = this.options.airHeight;
|
|
510
518
|
this.mesh.castShadow = true;
|
|
511
519
|
this.add(this.mesh);
|
|
512
520
|
this.line = this.createBorder();
|
|
@@ -536,12 +544,17 @@ var Graphic = class extends Object3D {
|
|
|
536
544
|
return material;
|
|
537
545
|
}
|
|
538
546
|
initLineMaterial() {
|
|
539
|
-
const lineMaterial = new
|
|
540
|
-
color: this.options.strokeColor,
|
|
547
|
+
const lineMaterial = new LineMaterial({
|
|
548
|
+
color: new Color2(this.options.strokeColor).getHex(),
|
|
541
549
|
opacity: this.options.strokeOpacity,
|
|
542
550
|
transparent: true,
|
|
543
|
-
depthWrite: true
|
|
551
|
+
depthWrite: true,
|
|
552
|
+
linewidth: this.options.strokeWidth,
|
|
553
|
+
wireframe: false,
|
|
554
|
+
dashed: false
|
|
544
555
|
});
|
|
556
|
+
const { clientSize: { width, height } } = this.context;
|
|
557
|
+
lineMaterial.resolution.set(width, height);
|
|
545
558
|
return lineMaterial;
|
|
546
559
|
}
|
|
547
560
|
initMesh() {
|
|
@@ -550,8 +563,10 @@ var Graphic = class extends Object3D {
|
|
|
550
563
|
createBorder() {
|
|
551
564
|
const material = this.initLineMaterial();
|
|
552
565
|
const geometry = new EdgesGeometry(this.geometry);
|
|
553
|
-
const
|
|
554
|
-
|
|
566
|
+
const lineGeometry = new LineSegmentsGeometry();
|
|
567
|
+
lineGeometry.fromEdgesGeometry(geometry);
|
|
568
|
+
const line = new LineSegments2(lineGeometry, material);
|
|
569
|
+
line.position.z = this.options.airHeight;
|
|
555
570
|
return line;
|
|
556
571
|
}
|
|
557
572
|
raycast(raycaster) {
|
|
@@ -626,7 +641,7 @@ var Shadow = class extends Object3D2 {
|
|
|
626
641
|
});
|
|
627
642
|
const mesh = new Mesh2(geometry, material);
|
|
628
643
|
mesh.receiveShadow = true;
|
|
629
|
-
mesh.position.z = -
|
|
644
|
+
mesh.position.z = -10;
|
|
630
645
|
this.add(mesh);
|
|
631
646
|
this.plane = mesh;
|
|
632
647
|
return mesh;
|
|
@@ -2001,7 +2016,6 @@ var Context = class extends EventDispatcher5 {
|
|
|
2001
2016
|
position
|
|
2002
2017
|
});
|
|
2003
2018
|
}
|
|
2004
|
-
console.log("onClick", e.offsetX, e.offsetY);
|
|
2005
2019
|
const pois = this.getPoisByDeviceXy(e.offsetX, e.offsetY);
|
|
2006
2020
|
if (pois.length) {
|
|
2007
2021
|
this.dispatchEvent({ type: "poi-click", pois });
|
|
@@ -2296,7 +2310,7 @@ var defaultConfig = {
|
|
|
2296
2310
|
},
|
|
2297
2311
|
useFloorCache: true,
|
|
2298
2312
|
control: {
|
|
2299
|
-
maxPolar:
|
|
2313
|
+
maxPolar: 0.9
|
|
2300
2314
|
},
|
|
2301
2315
|
svg: {
|
|
2302
2316
|
circle: {
|
|
@@ -2462,9 +2476,9 @@ var BMap = class extends EventDispatcher6 {
|
|
|
2462
2476
|
const groundGraphics = grounds.map((ground) => new Graphic(this.context, ground.info));
|
|
2463
2477
|
curFloor.addGrounds(groundGraphics);
|
|
2464
2478
|
const graphicData = data.filter((item) => item.info.group !== "ground");
|
|
2465
|
-
graphicData.forEach((item) => {
|
|
2479
|
+
graphicData.forEach((item, index) => {
|
|
2466
2480
|
item.info.airHeight = 5;
|
|
2467
|
-
item.info.height = 5;
|
|
2481
|
+
item.info.height = 5 + index * 1e-4;
|
|
2468
2482
|
});
|
|
2469
2483
|
const legacyToGraphicMap = /* @__PURE__ */ new Map();
|
|
2470
2484
|
const graphics = graphicData.map((item) => {
|
|
@@ -2566,9 +2580,9 @@ var BMap = class extends EventDispatcher6 {
|
|
|
2566
2580
|
*/
|
|
2567
2581
|
changeMapType(type, duration = 500) {
|
|
2568
2582
|
if (type === "2d") {
|
|
2569
|
-
this.context.setPolarAngle(0);
|
|
2583
|
+
return this.context.setPolarAngle(0, duration);
|
|
2570
2584
|
} else {
|
|
2571
|
-
this.context.setPolarAngle(
|
|
2585
|
+
return this.context.setPolarAngle(0.9, duration);
|
|
2572
2586
|
}
|
|
2573
2587
|
}
|
|
2574
2588
|
/**
|