@aibee/crc-bmap 0.0.68 → 0.0.70
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 +2 -2
- package/example/vite.config.ts +1 -1
- package/lib/bmap.cjs.min.js +1 -1
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +65 -30
- package/lib/bmap.esm.js.map +3 -3
- package/lib/bmap.esm.min.js +1 -1
- package/lib/bmap.esm.min.js.map +3 -3
- package/lib/bmap.min.js +1 -1
- package/lib/bmap.min.js.map +3 -3
- package/lib/src/elements/graphic.d.ts +2 -2
- package/lib/src/elements/poi.d.ts +2 -0
- package/lib/src/factory/material.d.ts +7 -1
- package/lib/src/utils/color.d.ts +1 -0
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -410,6 +410,16 @@ function addAlphaToHexColor(hexColor, alpha) {
|
|
|
410
410
|
let newHexColor = `#${(1 << 24 | newR << 16 | newG << 8 | newB).toString(16).slice(1)}`;
|
|
411
411
|
return newHexColor;
|
|
412
412
|
}
|
|
413
|
+
function darkenColor(hexColor) {
|
|
414
|
+
let r = parseInt(hexColor.substring(1, 3), 16);
|
|
415
|
+
let g = parseInt(hexColor.substring(3, 5), 16);
|
|
416
|
+
let b = parseInt(hexColor.substring(5, 7), 16);
|
|
417
|
+
r = Math.floor(r * 0.95);
|
|
418
|
+
g = Math.floor(g * 0.95);
|
|
419
|
+
b = Math.floor(b * 0.95);
|
|
420
|
+
let darkHexColor = "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
421
|
+
return darkHexColor;
|
|
422
|
+
}
|
|
413
423
|
|
|
414
424
|
// src/utils/model.ts
|
|
415
425
|
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
|
|
@@ -430,7 +440,9 @@ function loadModel(url) {
|
|
|
430
440
|
loader = createLoader();
|
|
431
441
|
}
|
|
432
442
|
const p = new Promise((resolve, reject) => {
|
|
433
|
-
loader.load(url,
|
|
443
|
+
loader.load(url, (gltf) => {
|
|
444
|
+
resolve(gltf);
|
|
445
|
+
}, void 0, reject);
|
|
434
446
|
});
|
|
435
447
|
modelMap.set(url, p);
|
|
436
448
|
return p.then((gltf) => {
|
|
@@ -622,12 +634,20 @@ var Graphic = class extends Object3D {
|
|
|
622
634
|
return geometry;
|
|
623
635
|
}
|
|
624
636
|
initMaterial() {
|
|
625
|
-
const material = this.context.materialFactory.
|
|
637
|
+
const material = this.context.materialFactory.createMeshBasicMaterial({
|
|
626
638
|
color: this.options.fillColor,
|
|
627
639
|
opacity: this.options.fillOpacity
|
|
628
640
|
});
|
|
629
|
-
this.
|
|
630
|
-
|
|
641
|
+
if (this.options.height <= 1e-3) {
|
|
642
|
+
this.material = material;
|
|
643
|
+
return material;
|
|
644
|
+
}
|
|
645
|
+
const material1 = this.context.materialFactory.createMeshBasicMaterial({
|
|
646
|
+
color: darkenColor(this.options.fillColor),
|
|
647
|
+
opacity: this.options.fillOpacity
|
|
648
|
+
});
|
|
649
|
+
this.material = [material, material1];
|
|
650
|
+
return [material, material1];
|
|
631
651
|
}
|
|
632
652
|
initLineMaterial() {
|
|
633
653
|
const lineMaterial = this.context.materialFactory.createLineMaterial({
|
|
@@ -647,7 +667,7 @@ var Graphic = class extends Object3D {
|
|
|
647
667
|
getBorderPoints() {
|
|
648
668
|
const points = [];
|
|
649
669
|
const height = this.options.height + this.options.deltaHeight;
|
|
650
|
-
const { cds
|
|
670
|
+
const { cds } = this.options.geometry;
|
|
651
671
|
for (let j = 0; j < cds.length; j++) {
|
|
652
672
|
const curCds = cds[j];
|
|
653
673
|
for (let i = 0; i < curCds.length; i++) {
|
|
@@ -885,6 +905,7 @@ var Poi = class extends EventDispatcher2 {
|
|
|
885
905
|
__publicField(this, "visible", true);
|
|
886
906
|
__publicField(this, "size", { width: 0, height: 0 });
|
|
887
907
|
__publicField(this, "position", new Vector35());
|
|
908
|
+
__publicField(this, "userData", {});
|
|
888
909
|
__publicField(this, "_changePosition", () => {
|
|
889
910
|
});
|
|
890
911
|
this.options = proxyOptions(__spreadValues(__spreadValues({}, defaultOptions3), options), this);
|
|
@@ -1036,21 +1057,21 @@ var Poi = class extends EventDispatcher2 {
|
|
|
1036
1057
|
return;
|
|
1037
1058
|
}
|
|
1038
1059
|
this.visible = visible;
|
|
1039
|
-
|
|
1040
|
-
this.overlay.visible = visible;
|
|
1041
|
-
this.overlay.div.style.visibility = visible ? "visible" : "hidden";
|
|
1042
|
-
}
|
|
1060
|
+
this.changeOverlayVisible(visible);
|
|
1043
1061
|
}
|
|
1044
|
-
|
|
1045
|
-
if (!this.visible) {
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1062
|
+
changeOverlayVisible(visible) {
|
|
1048
1063
|
if (visible === this.overlay.visible) {
|
|
1049
1064
|
return;
|
|
1050
1065
|
}
|
|
1051
1066
|
this.overlay.visible = visible;
|
|
1052
1067
|
this.overlay.div.style.visibility = visible ? "visible" : "hidden";
|
|
1053
1068
|
}
|
|
1069
|
+
parentSetVisible(visible) {
|
|
1070
|
+
if (!this.visible) {
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
this.changeOverlayVisible(visible);
|
|
1074
|
+
}
|
|
1054
1075
|
getBox() {
|
|
1055
1076
|
const { width, height } = this.size;
|
|
1056
1077
|
const { x, y } = this.overlay.clientPos;
|
|
@@ -1290,7 +1311,7 @@ var PoiLayer = class extends Layer {
|
|
|
1290
1311
|
|
|
1291
1312
|
// src/elements/heatmap.ts
|
|
1292
1313
|
import {
|
|
1293
|
-
MeshBasicMaterial,
|
|
1314
|
+
MeshBasicMaterial as MeshBasicMaterial2,
|
|
1294
1315
|
Object3D as Object3D6,
|
|
1295
1316
|
PlaneGeometry as PlaneGeometry2,
|
|
1296
1317
|
Texture,
|
|
@@ -1335,7 +1356,7 @@ var HeatmapElement = class extends Object3D6 {
|
|
|
1335
1356
|
const geometry = new PlaneGeometry2(width, height);
|
|
1336
1357
|
const texture = new Texture(this.div.firstChild);
|
|
1337
1358
|
texture.needsUpdate = true;
|
|
1338
|
-
const material = new
|
|
1359
|
+
const material = new MeshBasicMaterial2({
|
|
1339
1360
|
transparent: true,
|
|
1340
1361
|
side: DoubleSide2,
|
|
1341
1362
|
map: texture
|
|
@@ -1399,7 +1420,6 @@ var Model = class extends Object3D7 {
|
|
|
1399
1420
|
loadModel() {
|
|
1400
1421
|
return __async(this, null, function* () {
|
|
1401
1422
|
const object = yield loadModel(this.options.modelUrl);
|
|
1402
|
-
console.log(object);
|
|
1403
1423
|
object.scene.rotation.set(Math.PI / 2, Math.PI / 2, 0);
|
|
1404
1424
|
this.add(object.scene);
|
|
1405
1425
|
this.model = object;
|
|
@@ -2252,12 +2272,13 @@ var HoverHelper = class extends EventDispatcher5 {
|
|
|
2252
2272
|
};
|
|
2253
2273
|
|
|
2254
2274
|
// src/factory/material.ts
|
|
2255
|
-
import { LineBasicMaterial as LineBasicMaterial2, MeshStandardMaterial as
|
|
2275
|
+
import { LineBasicMaterial as LineBasicMaterial2, MeshStandardMaterial as MeshStandardMaterial2, MeshBasicMaterial as MeshBasicMaterial3 } from "three";
|
|
2256
2276
|
var MaterialFactory = class {
|
|
2257
2277
|
constructor(context) {
|
|
2258
2278
|
this.context = context;
|
|
2259
2279
|
__publicField(this, "lineMaterialMap", /* @__PURE__ */ new Map());
|
|
2260
2280
|
__publicField(this, "meshStandardMaterialMap", /* @__PURE__ */ new Map());
|
|
2281
|
+
__publicField(this, "meshBasicMaterialMap", /* @__PURE__ */ new Map());
|
|
2261
2282
|
}
|
|
2262
2283
|
generateLineMaterialKey({ color, opacity }) {
|
|
2263
2284
|
return `${color}-${opacity}`;
|
|
@@ -2280,7 +2301,7 @@ var MaterialFactory = class {
|
|
|
2280
2301
|
if (this.meshStandardMaterialMap.has(key)) {
|
|
2281
2302
|
return this.meshStandardMaterialMap.get(key);
|
|
2282
2303
|
}
|
|
2283
|
-
const material = new
|
|
2304
|
+
const material = new MeshStandardMaterial2({
|
|
2284
2305
|
color,
|
|
2285
2306
|
roughness: 1,
|
|
2286
2307
|
transparent: true,
|
|
@@ -2290,11 +2311,33 @@ var MaterialFactory = class {
|
|
|
2290
2311
|
this.meshStandardMaterialMap.set(key, material);
|
|
2291
2312
|
return material;
|
|
2292
2313
|
}
|
|
2314
|
+
createMeshBasicMaterial({ color, opacity }) {
|
|
2315
|
+
const key = `${color}-${opacity}`;
|
|
2316
|
+
if (this.meshBasicMaterialMap.has(key)) {
|
|
2317
|
+
return this.meshBasicMaterialMap.get(key);
|
|
2318
|
+
}
|
|
2319
|
+
const material = new MeshBasicMaterial3({
|
|
2320
|
+
color,
|
|
2321
|
+
transparent: true,
|
|
2322
|
+
opacity,
|
|
2323
|
+
depthWrite: true
|
|
2324
|
+
});
|
|
2325
|
+
this.meshBasicMaterialMap.set(key, material);
|
|
2326
|
+
return material;
|
|
2327
|
+
}
|
|
2293
2328
|
dispose() {
|
|
2294
2329
|
this.lineMaterialMap.forEach((val, _) => {
|
|
2295
2330
|
val.dispose();
|
|
2296
2331
|
});
|
|
2297
2332
|
this.lineMaterialMap.clear();
|
|
2333
|
+
this.meshStandardMaterialMap.forEach((val, _) => {
|
|
2334
|
+
val.dispose();
|
|
2335
|
+
});
|
|
2336
|
+
this.meshStandardMaterialMap.clear();
|
|
2337
|
+
this.meshBasicMaterialMap.forEach((val, _) => {
|
|
2338
|
+
val.dispose();
|
|
2339
|
+
});
|
|
2340
|
+
this.meshBasicMaterialMap.clear();
|
|
2298
2341
|
}
|
|
2299
2342
|
};
|
|
2300
2343
|
|
|
@@ -2310,16 +2353,6 @@ var CameraBound = class {
|
|
|
2310
2353
|
});
|
|
2311
2354
|
__publicField(this, "enable", true);
|
|
2312
2355
|
__publicField(this, "onCameraChange", () => {
|
|
2313
|
-
const bound = this.getCurFloorScreenPosition();
|
|
2314
|
-
if (bound) {
|
|
2315
|
-
const { left, right, top, bottom } = bound;
|
|
2316
|
-
const isInBound = this.checkDistanceToScreenEdge({ left, right, top, bottom });
|
|
2317
|
-
if (isInBound) {
|
|
2318
|
-
this.changePrevCamera();
|
|
2319
|
-
} else {
|
|
2320
|
-
this.backToPrevCamera();
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
2356
|
});
|
|
2324
2357
|
this.registryEvent();
|
|
2325
2358
|
this.changePrevCamera();
|
|
@@ -2726,8 +2759,9 @@ var Context = class extends EventDispatcher6 {
|
|
|
2726
2759
|
const start = this.camera.position.clone();
|
|
2727
2760
|
const lookAtVector = this.getCameraLookAt();
|
|
2728
2761
|
const tween = new Tween(start, this.tweenGroup).to(position, duration).onUpdate(() => {
|
|
2729
|
-
this.camera.position.copy(start);
|
|
2730
|
-
this.control.target.copy(
|
|
2762
|
+
this.camera.position.copy(start.clone().sub(lookAtVector));
|
|
2763
|
+
this.control.target.copy(start.clone());
|
|
2764
|
+
this.control.update();
|
|
2731
2765
|
}).onComplete(() => {
|
|
2732
2766
|
this.tweenGroup.remove(tween);
|
|
2733
2767
|
this.camera.position.copy(start.clone().sub(lookAtVector));
|
|
@@ -3387,6 +3421,7 @@ export {
|
|
|
3387
3421
|
createRect,
|
|
3388
3422
|
createSvg,
|
|
3389
3423
|
createSvgElement,
|
|
3424
|
+
darkenColor,
|
|
3390
3425
|
defaultConfig,
|
|
3391
3426
|
dispose,
|
|
3392
3427
|
disposeLoader,
|