venue-js 1.2.0-next.15 → 1.2.0-next.17
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/dist/index.d.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +6 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -84
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -905,11 +905,8 @@ import turfBuffer from "@turf/buffer";
|
|
|
905
905
|
import {
|
|
906
906
|
TextureLoader as TextureLoader2,
|
|
907
907
|
SpriteMaterial as SpriteMaterial3,
|
|
908
|
-
MeshLambertMaterial
|
|
909
|
-
AmbientLight,
|
|
910
|
-
DirectionalLight
|
|
908
|
+
MeshLambertMaterial
|
|
911
909
|
} from "three";
|
|
912
|
-
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
913
910
|
|
|
914
911
|
// src/IndoorMap/object3d/Billboard.js
|
|
915
912
|
import * as maptalks from "maptalks";
|
|
@@ -1503,36 +1500,6 @@ var createPedestrianOpening = (feature2, style, options = {}) => {
|
|
|
1503
1500
|
console.log(`error creating pedestrian opening:`, feature2);
|
|
1504
1501
|
}
|
|
1505
1502
|
};
|
|
1506
|
-
var loadModel3d = (model3d, coordinate, threeLayer) => {
|
|
1507
|
-
return new Promise((resolve, reject) => {
|
|
1508
|
-
const loader = new GLTFLoader();
|
|
1509
|
-
const { url, properties: modelProperties } = model3d;
|
|
1510
|
-
loader.load(
|
|
1511
|
-
url,
|
|
1512
|
-
(gltf) => {
|
|
1513
|
-
const object3d = gltf.scene;
|
|
1514
|
-
object3d.rotation.x = _4.get(modelProperties, "rotation.x");
|
|
1515
|
-
object3d.rotation.y = _4.get(modelProperties, "rotation.y");
|
|
1516
|
-
object3d.scale.set(..._4.get(modelProperties, "scale") || []);
|
|
1517
|
-
const object = threeLayer.toModel(object3d, {
|
|
1518
|
-
coordinate
|
|
1519
|
-
});
|
|
1520
|
-
object.getObject3d().traverse((child) => {
|
|
1521
|
-
if (child.isMesh === true) {
|
|
1522
|
-
child.material.transparent = true;
|
|
1523
|
-
child.material.metalness = 0.1;
|
|
1524
|
-
}
|
|
1525
|
-
});
|
|
1526
|
-
resolve(object);
|
|
1527
|
-
},
|
|
1528
|
-
(xhr) => {
|
|
1529
|
-
},
|
|
1530
|
-
(error) => {
|
|
1531
|
-
reject(error);
|
|
1532
|
-
}
|
|
1533
|
-
);
|
|
1534
|
-
});
|
|
1535
|
-
};
|
|
1536
1503
|
var createExtrudePolygon = (geometry, threeLayer, material, height, properties = {}, options) => {
|
|
1537
1504
|
const { offset = 0, altitude = 0 } = options;
|
|
1538
1505
|
const offsetGeometry = turfBuffer(geometry, offset, { units: "meters" });
|
|
@@ -2206,42 +2173,6 @@ var styledFeatureGenerator = (mapTheme) => {
|
|
|
2206
2173
|
return null;
|
|
2207
2174
|
}
|
|
2208
2175
|
},
|
|
2209
|
-
/** Three JS */
|
|
2210
|
-
create3DFootprint: async (feature2, threeLayer, options) => {
|
|
2211
|
-
const objects = [];
|
|
2212
|
-
const extrudeHeight = _4.get(options, "height");
|
|
2213
|
-
if (!extrudeHeight) return objects;
|
|
2214
|
-
const { properties } = feature2;
|
|
2215
|
-
const footprintProperties = getFeatureProperties(feature2);
|
|
2216
|
-
const hasModel3ds = Array.isArray(properties.model3d) && properties.model3d.length > 0;
|
|
2217
|
-
if (hasModel3ds) {
|
|
2218
|
-
const models = properties.model3d;
|
|
2219
|
-
const center2 = turfCenter(feature2);
|
|
2220
|
-
const coordinate = _4.get(center2, "geometry.coordinates");
|
|
2221
|
-
for (const model of models) {
|
|
2222
|
-
const object = await loadModel3d(model, coordinate, threeLayer);
|
|
2223
|
-
object.properties = footprintProperties;
|
|
2224
|
-
objects.push(object);
|
|
2225
|
-
}
|
|
2226
|
-
} else {
|
|
2227
|
-
const color = footprintProperties.defaultColor;
|
|
2228
|
-
if (color === "transparent") return;
|
|
2229
|
-
const material = new MeshLambertMaterial({
|
|
2230
|
-
color,
|
|
2231
|
-
transparent: true
|
|
2232
|
-
});
|
|
2233
|
-
const object = createExtrudePolygon(
|
|
2234
|
-
feature2.geometry,
|
|
2235
|
-
threeLayer,
|
|
2236
|
-
material,
|
|
2237
|
-
extrudeHeight,
|
|
2238
|
-
footprintProperties,
|
|
2239
|
-
{}
|
|
2240
|
-
);
|
|
2241
|
-
objects.push(object);
|
|
2242
|
-
}
|
|
2243
|
-
return objects;
|
|
2244
|
-
},
|
|
2245
2176
|
create3DBillboard: (billboard, threeLayer) => {
|
|
2246
2177
|
const { id, feature_type, properties } = billboard;
|
|
2247
2178
|
const {
|
|
@@ -2742,9 +2673,7 @@ var CameraManager = class {
|
|
|
2742
2673
|
};
|
|
2743
2674
|
|
|
2744
2675
|
// src/IndoorMap/renderer/RendererManager.ts
|
|
2745
|
-
import
|
|
2746
|
-
import _isFunction from "lodash/isFunction";
|
|
2747
|
-
import _min from "lodash/min";
|
|
2676
|
+
import { min, compact, isFunction } from "lodash-es";
|
|
2748
2677
|
import { center as turfCenter2 } from "@turf/center";
|
|
2749
2678
|
import * as THREE3 from "three";
|
|
2750
2679
|
|
|
@@ -4439,7 +4368,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4439
4368
|
if (this.#isClicked) return;
|
|
4440
4369
|
this.#isClicked = true;
|
|
4441
4370
|
const onClickElement = this.#onClickElement;
|
|
4442
|
-
if (!
|
|
4371
|
+
if (!isFunction(onClickElement)) return;
|
|
4443
4372
|
this.#onClickElement(e);
|
|
4444
4373
|
this.#isClicked = false;
|
|
4445
4374
|
};
|
|
@@ -4492,7 +4421,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4492
4421
|
});
|
|
4493
4422
|
units.filter((u4) => u4.properties.category === "room").forEach((unit) => {
|
|
4494
4423
|
const openingRelationships = relationships.filter((r) => r.properties.origin?.id === unit.id || r.properties.destination?.id === unit.id);
|
|
4495
|
-
const roomOpenings =
|
|
4424
|
+
const roomOpenings = compact(openingRelationships.map((rel) => {
|
|
4496
4425
|
const openingId = rel?.properties.intermediary[0].id;
|
|
4497
4426
|
return openings.find((o) => o.id === openingId);
|
|
4498
4427
|
}));
|
|
@@ -4578,7 +4507,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4578
4507
|
this.markerRenderer.showMarkers(markers, ordinal - baseOrdinal);
|
|
4579
4508
|
}
|
|
4580
4509
|
} else {
|
|
4581
|
-
const baseOrdinal = Array.isArray(targetOrdinal) ?
|
|
4510
|
+
const baseOrdinal = Array.isArray(targetOrdinal) ? min(targetOrdinal) : targetOrdinal;
|
|
4582
4511
|
for (const [ordinal, elements] of this.elementsByOrdinal) {
|
|
4583
4512
|
const inOrdinal = Array.isArray(targetOrdinal) ? targetOrdinal.includes(ordinal) : ordinal === targetOrdinal;
|
|
4584
4513
|
if (inOrdinal) {
|
|
@@ -4605,7 +4534,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4605
4534
|
const elements = elemIds.map((id) => this.elementsMap.get(id)).flat();
|
|
4606
4535
|
elements.forEach((element) => {
|
|
4607
4536
|
const controller = this.elementRenderer.createHighlightController(element);
|
|
4608
|
-
if (controller &&
|
|
4537
|
+
if (controller && isFunction(controller.start)) {
|
|
4609
4538
|
controller.start();
|
|
4610
4539
|
this.highlightControllers.push(controller);
|
|
4611
4540
|
}
|
|
@@ -4613,7 +4542,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4613
4542
|
};
|
|
4614
4543
|
clearHighlightElements = () => {
|
|
4615
4544
|
this.highlightControllers.forEach((controller) => {
|
|
4616
|
-
if (
|
|
4545
|
+
if (isFunction(controller?.clear)) controller.clear();
|
|
4617
4546
|
});
|
|
4618
4547
|
};
|
|
4619
4548
|
/**
|
|
@@ -4889,18 +4818,12 @@ var IndoorMap = class extends EventTarget {
|
|
|
4889
4818
|
async #legacy_createElements() {
|
|
4890
4819
|
const {
|
|
4891
4820
|
// 2D
|
|
4892
|
-
createVenue,
|
|
4893
4821
|
createOpening,
|
|
4894
4822
|
createSection,
|
|
4895
|
-
createFixture,
|
|
4896
|
-
createOccupant,
|
|
4897
4823
|
createDecoration,
|
|
4898
4824
|
// 3D
|
|
4899
|
-
create3DFootprint,
|
|
4900
4825
|
create3DBillboard,
|
|
4901
|
-
createExtrudedUnit,
|
|
4902
4826
|
create3DAmenityMarker,
|
|
4903
|
-
create3DOccupantAmenityMarker,
|
|
4904
4827
|
create3DOpeningMarker
|
|
4905
4828
|
} = this.#styler;
|
|
4906
4829
|
let elements = {};
|