@aibee/crc-bmap 0.1.3 → 0.1.4
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.cjs.min.js +5 -5
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +66 -28
- package/lib/bmap.esm.js.map +3 -3
- package/lib/bmap.esm.min.js +5 -5
- package/lib/bmap.esm.min.js.map +3 -3
- package/lib/bmap.min.js +5 -5
- package/lib/bmap.min.js.map +3 -3
- package/lib/src/elements/poi2.d.ts +1 -0
- package/lib/src/plugins/navigation/navigation.d.ts +3 -1
- package/lib/src/plugins/navigation/path.d.ts +1 -0
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -5318,7 +5318,8 @@ var defaultOptions4 = {
|
|
|
5318
5318
|
opacity: 1,
|
|
5319
5319
|
id: "",
|
|
5320
5320
|
position: { x: 0, y: 0, z: 0 },
|
|
5321
|
-
text_font_size: 14
|
|
5321
|
+
text_font_size: 14,
|
|
5322
|
+
icon_rotate: 0
|
|
5322
5323
|
};
|
|
5323
5324
|
var Poi2 = class extends Object3D14 {
|
|
5324
5325
|
constructor(context, options) {
|
|
@@ -5386,6 +5387,11 @@ var Poi2 = class extends Object3D14 {
|
|
|
5386
5387
|
this.initSize();
|
|
5387
5388
|
this._initScale({ zoom: this.context.camera.zoom });
|
|
5388
5389
|
});
|
|
5390
|
+
this.addEventListener("change-icon_rotate", ({ value }) => {
|
|
5391
|
+
if (this.spriteIcon) {
|
|
5392
|
+
this.spriteIcon.material.rotation = value / 180 * Math.PI;
|
|
5393
|
+
}
|
|
5394
|
+
});
|
|
5389
5395
|
}
|
|
5390
5396
|
unRegistryEvent() {
|
|
5391
5397
|
this.context.removeEventListener("control-zoom-change", this._initScale);
|
|
@@ -5398,7 +5404,8 @@ var Poi2 = class extends Object3D14 {
|
|
|
5398
5404
|
map: texture,
|
|
5399
5405
|
transparent: true,
|
|
5400
5406
|
alphaTest: 0.2,
|
|
5401
|
-
depthTest: false
|
|
5407
|
+
depthTest: false,
|
|
5408
|
+
rotation: this.options.icon_rotate / 180 * Math.PI
|
|
5402
5409
|
})
|
|
5403
5410
|
);
|
|
5404
5411
|
spriteIcon.visible = false;
|
|
@@ -7943,6 +7950,7 @@ var Path2 = class extends Object3D18 {
|
|
|
7943
7950
|
this.onControlChange
|
|
7944
7951
|
);
|
|
7945
7952
|
this.navigation.bmap.context.addEventListener("update", this.onUpdate);
|
|
7953
|
+
this.navigation.bmap.context.addEventListener("resize", this.onResize);
|
|
7946
7954
|
}
|
|
7947
7955
|
unRegistryEvent() {
|
|
7948
7956
|
this.navigation.bmap.context.removeEventListener(
|
|
@@ -7950,6 +7958,7 @@ var Path2 = class extends Object3D18 {
|
|
|
7950
7958
|
this.onControlChange
|
|
7951
7959
|
);
|
|
7952
7960
|
this.navigation.bmap.context.removeEventListener("update", this.onUpdate);
|
|
7961
|
+
this.navigation.bmap.context.removeEventListener("resize", this.onResize);
|
|
7953
7962
|
}
|
|
7954
7963
|
onControlChange = () => {
|
|
7955
7964
|
const zoom = this.navigation.bmap.context.camera.zoom;
|
|
@@ -7963,6 +7972,12 @@ var Path2 = class extends Object3D18 {
|
|
|
7963
7972
|
return;
|
|
7964
7973
|
}
|
|
7965
7974
|
};
|
|
7975
|
+
onResize = () => {
|
|
7976
|
+
if (this.material) {
|
|
7977
|
+
const { width, height } = this.navigation.bmap.context.clientSize;
|
|
7978
|
+
this.material.resolution.set(width, height);
|
|
7979
|
+
}
|
|
7980
|
+
};
|
|
7966
7981
|
getRepeat() {
|
|
7967
7982
|
const {
|
|
7968
7983
|
points,
|
|
@@ -8219,10 +8234,6 @@ var Navigation = class extends Plugin {
|
|
|
8219
8234
|
this.path.position.z = this.bmap.context.currentFloor.groundMaxHeight + 0.5;
|
|
8220
8235
|
this.bmap.context.scene.add(this.path);
|
|
8221
8236
|
}
|
|
8222
|
-
this.dispatchEvent({
|
|
8223
|
-
type: "render-path",
|
|
8224
|
-
path: this.path
|
|
8225
|
-
});
|
|
8226
8237
|
if (this.startPoi) {
|
|
8227
8238
|
this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi);
|
|
8228
8239
|
this.startPoi = null;
|
|
@@ -8236,6 +8247,10 @@ var Navigation = class extends Plugin {
|
|
|
8236
8247
|
}) || null;
|
|
8237
8248
|
this.bmap.context.currentFloor?.poiLayer2.pushPoi(this.startPoi);
|
|
8238
8249
|
}
|
|
8250
|
+
this.dispatchEvent({
|
|
8251
|
+
type: "render-path",
|
|
8252
|
+
path: this.path
|
|
8253
|
+
});
|
|
8239
8254
|
}
|
|
8240
8255
|
catmullRomCurve3(points) {
|
|
8241
8256
|
return simplifyPath(points, false, true, 0.1, 170, 2.5);
|
|
@@ -8497,27 +8512,37 @@ var Navigation = class extends Plugin {
|
|
|
8497
8512
|
});
|
|
8498
8513
|
}
|
|
8499
8514
|
// 吸附路线
|
|
8500
|
-
adsorb(position) {
|
|
8515
|
+
adsorb(floor, position) {
|
|
8501
8516
|
if (!this.curFloorPathPoints.length) {
|
|
8502
8517
|
return null;
|
|
8503
8518
|
}
|
|
8504
8519
|
let path = this.curFloorPathPoints;
|
|
8505
8520
|
if (this.currentPathPosition) {
|
|
8506
|
-
const
|
|
8507
|
-
path = path.slice(
|
|
8521
|
+
const index2 = getPointEdgeIndex(this.curFloorPathPoints, this.currentPathPosition);
|
|
8522
|
+
path = path.slice(index2 + 1);
|
|
8508
8523
|
path.unshift(this.currentPathPosition);
|
|
8509
8524
|
}
|
|
8510
|
-
const
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8525
|
+
const paths = [
|
|
8526
|
+
{ floor: this.curFloorPath?.floor, points: path },
|
|
8527
|
+
...this.paths.slice(this.curPathIndex + 1)
|
|
8528
|
+
].filter((item) => item.floor === floor);
|
|
8529
|
+
const { distance, closestPoint, index } = paths.reduce((obj, cur, index2) => {
|
|
8530
|
+
const { distance: distance2, closestPoint: closestPoint2 } = cur.points.reduce((obj2, cur2, index3, arr) => {
|
|
8531
|
+
if (!arr[index3 + 1]) {
|
|
8532
|
+
return obj2;
|
|
8533
|
+
}
|
|
8534
|
+
const { distance: distance3, closestPoint: closestPoint3 } = distancePointToSegment(position, cur2, arr[index3 + 1]);
|
|
8535
|
+
if (distance3 < obj2.distance) {
|
|
8536
|
+
return { distance: distance3, closestPoint: closestPoint3 };
|
|
8537
|
+
}
|
|
8538
|
+
return obj2;
|
|
8539
|
+
}, { distance: Infinity, closestPoint: path[0] });
|
|
8515
8540
|
if (distance2 < obj.distance) {
|
|
8516
|
-
return { distance: distance2, closestPoint: closestPoint2 };
|
|
8541
|
+
return { distance: distance2, closestPoint: closestPoint2, index: index2 };
|
|
8517
8542
|
}
|
|
8518
8543
|
return obj;
|
|
8519
|
-
}, { distance: Infinity, closestPoint: path[0] });
|
|
8520
|
-
return { distance, closestPoint };
|
|
8544
|
+
}, { distance: Infinity, closestPoint: path[0], index: 0 });
|
|
8545
|
+
return { distance, closestPoint, index: index + this.curPathIndex };
|
|
8521
8546
|
}
|
|
8522
8547
|
// 计算剩余距离
|
|
8523
8548
|
getRemainDistance() {
|
|
@@ -8571,6 +8596,13 @@ var Navigation = class extends Plugin {
|
|
|
8571
8596
|
nextDirDistance: distance
|
|
8572
8597
|
});
|
|
8573
8598
|
}
|
|
8599
|
+
setStartPoiRotate(rotate) {
|
|
8600
|
+
if (this.startPoi) {
|
|
8601
|
+
const azimuthalAngle = this.bmap.context.control.getAzimuthalAngle();
|
|
8602
|
+
const azimuthal = azimuthalAngle * 180 / Math.PI;
|
|
8603
|
+
this.startPoi.options.icon_rotate = rotate - azimuthal;
|
|
8604
|
+
}
|
|
8605
|
+
}
|
|
8574
8606
|
dispose() {
|
|
8575
8607
|
this.tweenUtil.dispose();
|
|
8576
8608
|
this.unRegistryEvent();
|
|
@@ -9389,17 +9421,21 @@ var AibeeLoader = class {
|
|
|
9389
9421
|
const graphic = floor.addGraphic(options);
|
|
9390
9422
|
floor.userData.graphics.push(graphic);
|
|
9391
9423
|
floor.userData.graphicMap.set(options.id, graphic);
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
poi
|
|
9402
|
-
|
|
9424
|
+
try {
|
|
9425
|
+
const poi = new Poi2(this.bmap.context, {
|
|
9426
|
+
id: options.id,
|
|
9427
|
+
icon: options.poi_info.icon,
|
|
9428
|
+
text: options.poi_info.showName || options.store_name || options.poi_info.text,
|
|
9429
|
+
position: { x: pos[0], y: pos[1], z: options.airHeight + options.height },
|
|
9430
|
+
icon_size: [18, 18]
|
|
9431
|
+
});
|
|
9432
|
+
floor.poiLayer2.pushPoi(poi);
|
|
9433
|
+
if (poi) {
|
|
9434
|
+
poi.userData.type = "store";
|
|
9435
|
+
poi.userData.data = options;
|
|
9436
|
+
}
|
|
9437
|
+
} catch (e) {
|
|
9438
|
+
console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25", e, options);
|
|
9403
9439
|
}
|
|
9404
9440
|
});
|
|
9405
9441
|
break;
|
|
@@ -9424,6 +9460,8 @@ var AibeeLoader = class {
|
|
|
9424
9460
|
floor.poiLayer2.pushPoi(poi);
|
|
9425
9461
|
poi.userData.type = "facility";
|
|
9426
9462
|
poi.userData.data = options;
|
|
9463
|
+
} else {
|
|
9464
|
+
console.log("\u6DFB\u52A0facility\u5931\u8D25\u6CA1\u6709poi_info", options);
|
|
9427
9465
|
}
|
|
9428
9466
|
});
|
|
9429
9467
|
break;
|