@aibee/crc-bmap 0.0.68 → 0.0.69

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
@@ -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, resolve, void 0, reject);
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.createMeshStandardMaterial({
637
+ const material = this.context.materialFactory.createMeshBasicMaterial({
626
638
  color: this.options.fillColor,
627
639
  opacity: this.options.fillOpacity
628
640
  });
629
- this.material = material;
630
- return material;
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, curveIndex } = this.options.geometry;
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);
@@ -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 MeshBasicMaterial({
1359
+ const material = new MeshBasicMaterial2({
1339
1360
  transparent: true,
1340
1361
  side: DoubleSide2,
1341
1362
  map: texture
@@ -2252,12 +2273,13 @@ var HoverHelper = class extends EventDispatcher5 {
2252
2273
  };
2253
2274
 
2254
2275
  // src/factory/material.ts
2255
- import { LineBasicMaterial as LineBasicMaterial2, MeshStandardMaterial as MeshStandardMaterial3 } from "three";
2276
+ import { LineBasicMaterial as LineBasicMaterial2, MeshStandardMaterial as MeshStandardMaterial2, MeshBasicMaterial as MeshBasicMaterial3 } from "three";
2256
2277
  var MaterialFactory = class {
2257
2278
  constructor(context) {
2258
2279
  this.context = context;
2259
2280
  __publicField(this, "lineMaterialMap", /* @__PURE__ */ new Map());
2260
2281
  __publicField(this, "meshStandardMaterialMap", /* @__PURE__ */ new Map());
2282
+ __publicField(this, "meshBasicMaterialMap", /* @__PURE__ */ new Map());
2261
2283
  }
2262
2284
  generateLineMaterialKey({ color, opacity }) {
2263
2285
  return `${color}-${opacity}`;
@@ -2280,7 +2302,7 @@ var MaterialFactory = class {
2280
2302
  if (this.meshStandardMaterialMap.has(key)) {
2281
2303
  return this.meshStandardMaterialMap.get(key);
2282
2304
  }
2283
- const material = new MeshStandardMaterial3({
2305
+ const material = new MeshStandardMaterial2({
2284
2306
  color,
2285
2307
  roughness: 1,
2286
2308
  transparent: true,
@@ -2290,11 +2312,33 @@ var MaterialFactory = class {
2290
2312
  this.meshStandardMaterialMap.set(key, material);
2291
2313
  return material;
2292
2314
  }
2315
+ createMeshBasicMaterial({ color, opacity }) {
2316
+ const key = `${color}-${opacity}`;
2317
+ if (this.meshBasicMaterialMap.has(key)) {
2318
+ return this.meshBasicMaterialMap.get(key);
2319
+ }
2320
+ const material = new MeshBasicMaterial3({
2321
+ color,
2322
+ transparent: true,
2323
+ opacity,
2324
+ depthWrite: true
2325
+ });
2326
+ this.meshBasicMaterialMap.set(key, material);
2327
+ return material;
2328
+ }
2293
2329
  dispose() {
2294
2330
  this.lineMaterialMap.forEach((val, _) => {
2295
2331
  val.dispose();
2296
2332
  });
2297
2333
  this.lineMaterialMap.clear();
2334
+ this.meshStandardMaterialMap.forEach((val, _) => {
2335
+ val.dispose();
2336
+ });
2337
+ this.meshStandardMaterialMap.clear();
2338
+ this.meshBasicMaterialMap.forEach((val, _) => {
2339
+ val.dispose();
2340
+ });
2341
+ this.meshBasicMaterialMap.clear();
2298
2342
  }
2299
2343
  };
2300
2344
 
@@ -2310,16 +2354,6 @@ var CameraBound = class {
2310
2354
  });
2311
2355
  __publicField(this, "enable", true);
2312
2356
  __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
2357
  });
2324
2358
  this.registryEvent();
2325
2359
  this.changePrevCamera();
@@ -2726,8 +2760,9 @@ var Context = class extends EventDispatcher6 {
2726
2760
  const start = this.camera.position.clone();
2727
2761
  const lookAtVector = this.getCameraLookAt();
2728
2762
  const tween = new Tween(start, this.tweenGroup).to(position, duration).onUpdate(() => {
2729
- this.camera.position.copy(start);
2730
- this.control.target.copy(position.clone().add(lookAtVector));
2763
+ this.camera.position.copy(start.clone().sub(lookAtVector));
2764
+ this.control.target.copy(start.clone());
2765
+ this.control.update();
2731
2766
  }).onComplete(() => {
2732
2767
  this.tweenGroup.remove(tween);
2733
2768
  this.camera.position.copy(start.clone().sub(lookAtVector));
@@ -3387,6 +3422,7 @@ export {
3387
3422
  createRect,
3388
3423
  createSvg,
3389
3424
  createSvgElement,
3425
+ darkenColor,
3390
3426
  defaultConfig,
3391
3427
  dispose,
3392
3428
  disposeLoader,