venue-js 1.2.0-next.10 → 1.2.0-next.12
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 +17 -24
- package/dist/index.d.ts +17 -24
- package/dist/index.js +69 -269
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -263
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -685,18 +685,16 @@ var getDataClient = (options) => {
|
|
|
685
685
|
|
|
686
686
|
// src/IndoorMap/IndoorMap.ts
|
|
687
687
|
import {
|
|
688
|
-
ui as ui3,
|
|
689
688
|
Map as Map2,
|
|
690
689
|
TileLayer,
|
|
691
690
|
LineString as LineString3,
|
|
692
|
-
Marker as Marker2,
|
|
693
691
|
Coordinate as Coordinate4,
|
|
694
692
|
GroupGLLayer,
|
|
695
693
|
GLTFLayer
|
|
696
694
|
} from "maptalks-gl";
|
|
697
695
|
import "@maptalks/transcoders.draco";
|
|
698
|
-
import
|
|
699
|
-
import
|
|
696
|
+
import TWEEN from "@tweenjs/tween.js";
|
|
697
|
+
import _5 from "lodash";
|
|
700
698
|
|
|
701
699
|
// ../../node_modules/@turf/helpers/dist/esm/index.js
|
|
702
700
|
var earthRadius = 63710088e-1;
|
|
@@ -795,7 +793,6 @@ var GEOLOCATION = "geolocation";
|
|
|
795
793
|
var ORIGIN_MARKER = "origin-marker";
|
|
796
794
|
var DESTINATION_MARKER = "destination-marker";
|
|
797
795
|
var DECORATION = "decoration";
|
|
798
|
-
var ALWAYS_VISIBLE_FEATURE_TYPES = [VENUE, FOOTPRINT];
|
|
799
796
|
var BASE_LAYER_NAME = "base";
|
|
800
797
|
var POI_MARKER_LAYER_NAME = "poi";
|
|
801
798
|
var MARKER_LAYER_NAME = "marker";
|
|
@@ -807,13 +804,6 @@ var USER_LOCATION_ELEMENT_ID = "user_location";
|
|
|
807
804
|
var LAST_USER_LOCATION_ELEMENT_ID_PREFIX = "last_user_location-";
|
|
808
805
|
var LOCALE_SYMBOL_KEY = "locale_symbol";
|
|
809
806
|
var DEFAULT_LOCALE = "en";
|
|
810
|
-
var DEFAULT_HIGHLIGHT_OPTIONS = {
|
|
811
|
-
symbolSet: null
|
|
812
|
-
};
|
|
813
|
-
var DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS = {
|
|
814
|
-
symbolSet: null,
|
|
815
|
-
defaultMarker: false
|
|
816
|
-
};
|
|
817
807
|
var LAYERS = [
|
|
818
808
|
BASE_LAYER_NAME,
|
|
819
809
|
POI_MARKER_LAYER_NAME,
|
|
@@ -2874,45 +2864,6 @@ var getSuitablyValueBetweenBearings = (newBearing, currentBearing) => {
|
|
|
2874
2864
|
return newBearing;
|
|
2875
2865
|
};
|
|
2876
2866
|
|
|
2877
|
-
// src/IndoorMap/utils/createHighlightElement.ts
|
|
2878
|
-
import { Color as Color2 } from "three";
|
|
2879
|
-
import _5 from "lodash";
|
|
2880
|
-
import TWEEN from "@tweenjs/tween.js";
|
|
2881
|
-
var DEFAULT_ALTITUDE_FACTOR = 0.5;
|
|
2882
|
-
var createHighlighBillboardController = (obj, { altitudeFactor = DEFAULT_ALTITUDE_FACTOR } = {}) => {
|
|
2883
|
-
const controller = { start: () => {
|
|
2884
|
-
}, clear: () => {
|
|
2885
|
-
} };
|
|
2886
|
-
if (!(obj instanceof Billboard)) return controller;
|
|
2887
|
-
const altitude = obj.properties.default.altitude;
|
|
2888
|
-
const newAltitude = _5.clamp(altitude * altitudeFactor, 0, altitude);
|
|
2889
|
-
const tween = new TWEEN.Tween({ altitude }).to({ altitude: newAltitude }, 800).easing(TWEEN.Easing.Quartic.Out).onUpdate((newUpdate) => {
|
|
2890
|
-
obj.setLineHeight(newUpdate.altitude);
|
|
2891
|
-
});
|
|
2892
|
-
controller.start = () => {
|
|
2893
|
-
tween.start();
|
|
2894
|
-
};
|
|
2895
|
-
controller.clear = () => {
|
|
2896
|
-
tween.stop().to({ altitude }, 1600).startFromCurrentValues();
|
|
2897
|
-
};
|
|
2898
|
-
return controller;
|
|
2899
|
-
};
|
|
2900
|
-
var createHighlighExtrudeObjectController = (obj, { color }) => {
|
|
2901
|
-
const controller = { start: () => {
|
|
2902
|
-
}, clear: () => {
|
|
2903
|
-
} };
|
|
2904
|
-
if (obj?.type !== "ExtrudePolygon" || _5.isNil(obj?.object3d?.material?.color) || _5.isNil(color))
|
|
2905
|
-
return controller;
|
|
2906
|
-
controller.start = () => {
|
|
2907
|
-
obj.object3d.material.color = new Color2(color);
|
|
2908
|
-
};
|
|
2909
|
-
controller.clear = () => {
|
|
2910
|
-
const objectDefaultColor = _5.get(obj, "properties.defaultColor");
|
|
2911
|
-
obj.object3d.material.color = new Color2(objectDefaultColor);
|
|
2912
|
-
};
|
|
2913
|
-
return controller;
|
|
2914
|
-
};
|
|
2915
|
-
|
|
2916
2867
|
// src/IndoorMap/camera/CameraManager.ts
|
|
2917
2868
|
import { Extent } from "maptalks";
|
|
2918
2869
|
|
|
@@ -3135,7 +3086,8 @@ var element3DRendererOptions = {
|
|
|
3135
3086
|
default: { color: "#ffffff", height: 0.5 },
|
|
3136
3087
|
byCategory: {
|
|
3137
3088
|
water: { color: "#ACD7EC", height: 0.1 },
|
|
3138
|
-
vegetation: { color: "#91C499", height: 0.5 }
|
|
3089
|
+
vegetation: { color: "#91C499", height: 0.5 },
|
|
3090
|
+
wall: { color: "#787878", topColor: "#ffffff", height: 4.2, width: 1 }
|
|
3139
3091
|
}
|
|
3140
3092
|
}
|
|
3141
3093
|
};
|
|
@@ -3242,6 +3194,20 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3242
3194
|
return [];
|
|
3243
3195
|
}
|
|
3244
3196
|
};
|
|
3197
|
+
const createLineString = (geometry, feature3) => {
|
|
3198
|
+
try {
|
|
3199
|
+
const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#000000";
|
|
3200
|
+
const material = this.getOrCreateMaterialByColor(color);
|
|
3201
|
+
const extrudedLine = this.threeLayer.toExtrudeLine(
|
|
3202
|
+
new maptalks4.LineString(geometry.coordinates),
|
|
3203
|
+
{ height: heightOptions, ...options },
|
|
3204
|
+
material
|
|
3205
|
+
);
|
|
3206
|
+
return [extrudedLine];
|
|
3207
|
+
} catch (err) {
|
|
3208
|
+
return [];
|
|
3209
|
+
}
|
|
3210
|
+
};
|
|
3245
3211
|
try {
|
|
3246
3212
|
switch (feature2.geometry.type) {
|
|
3247
3213
|
case "MultiPolygon": {
|
|
@@ -3261,6 +3227,13 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3261
3227
|
this.threeLayer.addMesh(meshes);
|
|
3262
3228
|
return meshes;
|
|
3263
3229
|
}
|
|
3230
|
+
case "LineString": {
|
|
3231
|
+
const { coordinates } = feature2.geometry;
|
|
3232
|
+
if (!coordinates) return [];
|
|
3233
|
+
const meshes = createLineString(feature2.geometry, feature2);
|
|
3234
|
+
this.threeLayer.addMesh(meshes);
|
|
3235
|
+
return meshes;
|
|
3236
|
+
}
|
|
3264
3237
|
}
|
|
3265
3238
|
} catch (err) {
|
|
3266
3239
|
console.log(`error createGeometry`, err, { feature: feature2, options });
|
|
@@ -3323,7 +3296,8 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3323
3296
|
return null;
|
|
3324
3297
|
}
|
|
3325
3298
|
switch (element.type) {
|
|
3326
|
-
case "ExtrudePolygon":
|
|
3299
|
+
case "ExtrudePolygon":
|
|
3300
|
+
case "ExtrudeLine": {
|
|
3327
3301
|
const mesh = element.getObject3d();
|
|
3328
3302
|
const originalMaterial = mesh.material;
|
|
3329
3303
|
const highlightMaterial = this.getOrCreateMaterialByColor("#ff0000");
|
|
@@ -4061,6 +4035,7 @@ var INITIAL_ZOOM = 18.5;
|
|
|
4061
4035
|
var CLICK_TOLERANCE = 20;
|
|
4062
4036
|
var defaultOptions = {
|
|
4063
4037
|
pixelRatio: 1,
|
|
4038
|
+
interactions: true,
|
|
4064
4039
|
locale: DEFAULT_LOCALE
|
|
4065
4040
|
};
|
|
4066
4041
|
var IndoorMap = class extends EventTarget {
|
|
@@ -4116,7 +4091,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4116
4091
|
};
|
|
4117
4092
|
constructor(elementId, options) {
|
|
4118
4093
|
super();
|
|
4119
|
-
const combinedOptions =
|
|
4094
|
+
const combinedOptions = _5.merge({}, defaultOptions, options);
|
|
4120
4095
|
this.options = options;
|
|
4121
4096
|
const {
|
|
4122
4097
|
onMapReady,
|
|
@@ -4132,6 +4107,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4132
4107
|
zoom: INITIAL_ZOOM,
|
|
4133
4108
|
clickTimeThreshold: 600,
|
|
4134
4109
|
centerCross: options.centerCross ?? false,
|
|
4110
|
+
...options.interactions === false ? {
|
|
4111
|
+
draggable: false,
|
|
4112
|
+
dragPan: false,
|
|
4113
|
+
dragRotate: false,
|
|
4114
|
+
dragPitch: false,
|
|
4115
|
+
scrollWheelZoom: false,
|
|
4116
|
+
touchZoom: false,
|
|
4117
|
+
doubleClickZoom: false
|
|
4118
|
+
} : {},
|
|
4135
4119
|
baseLayer: new TileLayer("base", {
|
|
4136
4120
|
urlTemplate: "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
|
|
4137
4121
|
subdomains: ["a", "b", "c", "d"],
|
|
@@ -4181,7 +4165,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4181
4165
|
handleMapClick = ({ coordinate }) => {
|
|
4182
4166
|
const { x, y } = coordinate;
|
|
4183
4167
|
console.log(
|
|
4184
|
-
`[Coordinates]: x: ${
|
|
4168
|
+
`[Coordinates]: x: ${_5.round(x, 8)} y: ${_5.round(
|
|
4185
4169
|
y,
|
|
4186
4170
|
8
|
|
4187
4171
|
)}, [Bearing]: ${this.map.getBearing()}, [Pitch]: ${this.map.getPitch()}`
|
|
@@ -4270,7 +4254,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4270
4254
|
if (this.#isClicked) return;
|
|
4271
4255
|
this.#isClicked = true;
|
|
4272
4256
|
const onClickElement = this.#onClickElement;
|
|
4273
|
-
if (!
|
|
4257
|
+
if (!_5.isFunction(onClickElement)) return;
|
|
4274
4258
|
this.#onClickElement(e);
|
|
4275
4259
|
this.#isClicked = false;
|
|
4276
4260
|
};
|
|
@@ -4298,16 +4282,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
4298
4282
|
for (const feature2 of this.#features) {
|
|
4299
4283
|
try {
|
|
4300
4284
|
const { feature_type: featureType, properties, id } = feature2;
|
|
4301
|
-
const layerName =
|
|
4285
|
+
const layerName = _5.get(
|
|
4302
4286
|
LAYER_FEATURE_TYPE_OBJ,
|
|
4303
4287
|
featureType,
|
|
4304
4288
|
featureType
|
|
4305
4289
|
);
|
|
4306
4290
|
const layer = this.map.getLayer(layerName);
|
|
4307
4291
|
let geometry;
|
|
4308
|
-
const category =
|
|
4309
|
-
const extrudeConfig =
|
|
4310
|
-
const textMarkerType =
|
|
4292
|
+
const category = _5.get(feature2, "properties.category");
|
|
4293
|
+
const extrudeConfig = _5.get(this.#mapConfig, "extrude");
|
|
4294
|
+
const textMarkerType = _5.get(
|
|
4311
4295
|
this.#mapConfig,
|
|
4312
4296
|
"text_marker_type",
|
|
4313
4297
|
"ui-marker"
|
|
@@ -4460,186 +4444,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4460
4444
|
clearAnimations() {
|
|
4461
4445
|
this.#animationsToRun = [];
|
|
4462
4446
|
}
|
|
4463
|
-
/**
|
|
4464
|
-
* Hilighting Elements
|
|
4465
|
-
* ========================================= */
|
|
4466
|
-
// TODO: To consider if we should use setter `set hilightElementIds` instead?
|
|
4467
|
-
setHighlightElementIds(targetElementIds, options = {}) {
|
|
4468
|
-
const highlight3DOptions = _6.merge(
|
|
4469
|
-
{},
|
|
4470
|
-
DEFAULT_HIGHLIGHT_OPTIONS,
|
|
4471
|
-
_6.get(options, "highlight3DOptions", {})
|
|
4472
|
-
);
|
|
4473
|
-
const highlight2DOptions = _6.merge(
|
|
4474
|
-
{},
|
|
4475
|
-
DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
|
|
4476
|
-
_6.get(options, "highlight2DOptions", {})
|
|
4477
|
-
);
|
|
4478
|
-
this.setHighlightedObject(targetElementIds, highlight3DOptions);
|
|
4479
|
-
return this.setHighlight2DElementIds(targetElementIds, highlight2DOptions);
|
|
4480
|
-
}
|
|
4481
|
-
setHighlight2DElementIds(targetElementIds, options = {}) {
|
|
4482
|
-
const { defaultMarker, symbolSet } = _6.merge(
|
|
4483
|
-
{},
|
|
4484
|
-
DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
|
|
4485
|
-
options
|
|
4486
|
-
);
|
|
4487
|
-
const {
|
|
4488
|
-
createMarker,
|
|
4489
|
-
createHighlightOccupantMarker,
|
|
4490
|
-
getElementSymbol,
|
|
4491
|
-
getHilighPolygonalSymbol,
|
|
4492
|
-
getHighlightMarkerSymbol
|
|
4493
|
-
} = this.#styler;
|
|
4494
|
-
const extrudeConfig = _6.get(this.#mapConfig, "extrude");
|
|
4495
|
-
const elementToHilights = targetElementIds.map(
|
|
4496
|
-
(elemId) => this.#elements[elemId] || this.#elements[`${LAST_USER_LOCATION_ELEMENT_ID_PREFIX}${elemId}`]
|
|
4497
|
-
).filter((elem) => elem);
|
|
4498
|
-
elementToHilights.forEach((elem) => {
|
|
4499
|
-
const { feature: feature2, geometry } = elem;
|
|
4500
|
-
if (!geometry || !feature2) return;
|
|
4501
|
-
const hilightLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
|
|
4502
|
-
if (!hilightLayer) return;
|
|
4503
|
-
const defaultSymbol = getHilighPolygonalSymbol(geometry.type);
|
|
4504
|
-
const definedSymbol = symbolSet ? getElementSymbol(symbolSet) : null;
|
|
4505
|
-
const symbol = _6.isEmpty(definedSymbol) ? defaultSymbol : definedSymbol;
|
|
4506
|
-
switch (geometry.type) {
|
|
4507
|
-
case "MultiPolygon":
|
|
4508
|
-
case "Polygon": {
|
|
4509
|
-
geometry?.updateSymbol(symbol);
|
|
4510
|
-
break;
|
|
4511
|
-
}
|
|
4512
|
-
default:
|
|
4513
|
-
break;
|
|
4514
|
-
}
|
|
4515
|
-
switch (feature2.feature_type) {
|
|
4516
|
-
case "amenity":
|
|
4517
|
-
const highlightedAmenityMarker = definedSymbol || getHighlightMarkerSymbol();
|
|
4518
|
-
geometry?.updateSymbol(highlightedAmenityMarker);
|
|
4519
|
-
break;
|
|
4520
|
-
case "occupant": {
|
|
4521
|
-
switch (feature2.properties.category) {
|
|
4522
|
-
case "currencyexchange":
|
|
4523
|
-
case "donationcenter":
|
|
4524
|
-
case "postoffice":
|
|
4525
|
-
const highlightedAmenityMarker2 = definedSymbol || getHighlightMarkerSymbol();
|
|
4526
|
-
geometry?.updateSymbol(highlightedAmenityMarker2);
|
|
4527
|
-
break;
|
|
4528
|
-
default:
|
|
4529
|
-
if (feature2.properties.render_type === "Logo") {
|
|
4530
|
-
this.hideGeometryByElementId(feature2.id);
|
|
4531
|
-
}
|
|
4532
|
-
createHighlightOccupantMarker(feature2, {
|
|
4533
|
-
extrudeConfig,
|
|
4534
|
-
symbol: definedSymbol
|
|
4535
|
-
}).on("click", this.handleClickElement).addTo(hilightLayer);
|
|
4536
|
-
break;
|
|
4537
|
-
}
|
|
4538
|
-
break;
|
|
4539
|
-
}
|
|
4540
|
-
case "opening":
|
|
4541
|
-
break;
|
|
4542
|
-
default:
|
|
4543
|
-
if (defaultMarker) createMarker(feature2).addTo(hilightLayer);
|
|
4544
|
-
break;
|
|
4545
|
-
}
|
|
4546
|
-
});
|
|
4547
|
-
this.#highlightElementIds = targetElementIds;
|
|
4548
|
-
if (elementToHilights.length === 0) return;
|
|
4549
|
-
return featureCollection(
|
|
4550
|
-
elementToHilights.map(({ feature: feature2 }) => {
|
|
4551
|
-
const { geometry } = feature2;
|
|
4552
|
-
if (feature2.feature_type === "occupant")
|
|
4553
|
-
return feature(feature2?.properties?.anchor?.geometry);
|
|
4554
|
-
return feature(geometry);
|
|
4555
|
-
})
|
|
4556
|
-
);
|
|
4557
|
-
}
|
|
4558
|
-
clearHighlightElements() {
|
|
4559
|
-
this.#clearAllElementOnLayerByName(HIGHLIGHT_LAYER_NAME);
|
|
4560
|
-
_6(this.#highlightElementIds).map((elemId) => this.#elements[elemId]?.geometry).compact().forEach((geometry) => {
|
|
4561
|
-
if (geometry instanceof ui3.UIMarker) return;
|
|
4562
|
-
if (geometry instanceof Marker2) {
|
|
4563
|
-
this.showGeometryByElementId(geometry.properties.id);
|
|
4564
|
-
return;
|
|
4565
|
-
}
|
|
4566
|
-
try {
|
|
4567
|
-
const defaultSymbol = geometry.options.defaultSymbol;
|
|
4568
|
-
geometry.updateSymbol(defaultSymbol);
|
|
4569
|
-
} catch (err) {
|
|
4570
|
-
console.log(
|
|
4571
|
-
`error cannot return to defaultSymbol, check if "defaultSymbol" exists in element creation function`
|
|
4572
|
-
);
|
|
4573
|
-
}
|
|
4574
|
-
});
|
|
4575
|
-
this.#highlightElementIds = [];
|
|
4576
|
-
}
|
|
4577
|
-
setHighlightedObject(targetObjectIds, options = {}) {
|
|
4578
|
-
const { symbolSet } = _6.merge({}, DEFAULT_HIGHLIGHT_OPTIONS, options);
|
|
4579
|
-
const {
|
|
4580
|
-
getElementSymbol,
|
|
4581
|
-
getHilighPolygonalSymbol,
|
|
4582
|
-
createHighlight2DAmenityMarkerFrom3DMarker
|
|
4583
|
-
} = this.#styler;
|
|
4584
|
-
const objects = this.threeLayer?.getBaseObjects();
|
|
4585
|
-
const objectsToHighlight = objects.filter(
|
|
4586
|
-
({ properties }) => targetObjectIds.includes(properties?.id)
|
|
4587
|
-
);
|
|
4588
|
-
const defaultSymbol = getHilighPolygonalSymbol("Polygon");
|
|
4589
|
-
const targetSymbol = symbolSet ? getElementSymbol(symbolSet) : null;
|
|
4590
|
-
const { polygonFill: color } = _6.isEmpty(targetSymbol) ? defaultSymbol : targetSymbol;
|
|
4591
|
-
const amenityHighlightMode = _6.get(
|
|
4592
|
-
this.#mapConfig,
|
|
4593
|
-
"amenity_highlight_mode",
|
|
4594
|
-
""
|
|
4595
|
-
);
|
|
4596
|
-
objectsToHighlight.forEach((obj) => {
|
|
4597
|
-
if (obj.type === "ExtrudePolygon") {
|
|
4598
|
-
const newController = createHighlighExtrudeObjectController(obj, {
|
|
4599
|
-
color
|
|
4600
|
-
});
|
|
4601
|
-
newController.start();
|
|
4602
|
-
this.#highlightObjectControllers.push(newController);
|
|
4603
|
-
}
|
|
4604
|
-
if (obj instanceof SpriteMarker) {
|
|
4605
|
-
if (amenityHighlightMode === "2DMarker") {
|
|
4606
|
-
const hilight2DLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
|
|
4607
|
-
const extrudeConfig = _6.get(this.#mapConfig, "extrude");
|
|
4608
|
-
obj.hide();
|
|
4609
|
-
const { properties: featureProperties } = obj;
|
|
4610
|
-
createHighlight2DAmenityMarkerFrom3DMarker(
|
|
4611
|
-
featureProperties,
|
|
4612
|
-
extrudeConfig
|
|
4613
|
-
).on("click", this.handleClickElement).addTo(hilight2DLayer);
|
|
4614
|
-
} else {
|
|
4615
|
-
obj.highlight();
|
|
4616
|
-
}
|
|
4617
|
-
}
|
|
4618
|
-
if (obj instanceof Billboard) {
|
|
4619
|
-
const newController = createHighlighBillboardController(obj);
|
|
4620
|
-
newController.start();
|
|
4621
|
-
this.#highlightObjectControllers.push(newController);
|
|
4622
|
-
}
|
|
4623
|
-
});
|
|
4624
|
-
this.#highlightObjectIds = targetObjectIds;
|
|
4625
|
-
}
|
|
4626
|
-
clearHighlightObject() {
|
|
4627
|
-
this.#highlightObjectControllers.forEach((controller) => {
|
|
4628
|
-
if (_6.isFunction(controller?.clear)) controller.clear();
|
|
4629
|
-
});
|
|
4630
|
-
this.#highlightObjectIds.forEach((objIds) => {
|
|
4631
|
-
const objects = this.threeLayer?.getBaseObjects();
|
|
4632
|
-
const objectToResetHighlight = objects.find(
|
|
4633
|
-
({ properties }) => objIds.includes(properties?.id)
|
|
4634
|
-
);
|
|
4635
|
-
if (objectToResetHighlight instanceof SpriteMarker) {
|
|
4636
|
-
objectToResetHighlight.show();
|
|
4637
|
-
objectToResetHighlight.removeHighlight();
|
|
4638
|
-
}
|
|
4639
|
-
});
|
|
4640
|
-
this.#highlightObjectControllers = [];
|
|
4641
|
-
this.#highlightObjectIds = [];
|
|
4642
|
-
}
|
|
4643
4447
|
/**
|
|
4644
4448
|
* User Location
|
|
4645
4449
|
****************************/
|
|
@@ -4664,15 +4468,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4664
4468
|
}
|
|
4665
4469
|
}
|
|
4666
4470
|
updateUserLocationSymbolByLocale(locale) {
|
|
4667
|
-
const userLocationGeometry =
|
|
4471
|
+
const userLocationGeometry = _5.get(
|
|
4668
4472
|
this.#elements,
|
|
4669
4473
|
`${USER_LOCATION_ELEMENT_ID}.geometry`
|
|
4670
4474
|
);
|
|
4671
4475
|
if (!userLocationGeometry) return;
|
|
4672
4476
|
const currentSymbol = userLocationGeometry.getSymbol();
|
|
4673
4477
|
const localeSymbolToUpdate = currentSymbol.map((symbol) => {
|
|
4674
|
-
const localeSymbol =
|
|
4675
|
-
if (!
|
|
4478
|
+
const localeSymbol = _5.get(symbol, `${LOCALE_SYMBOL_KEY}.${locale}`) || _5.get(symbol, `${LOCALE_SYMBOL_KEY}.default`);
|
|
4479
|
+
if (!_5.isPlainObject(localeSymbol)) return symbol;
|
|
4676
4480
|
return {
|
|
4677
4481
|
...symbol,
|
|
4678
4482
|
...localeSymbol
|
|
@@ -4746,14 +4550,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
4746
4550
|
* END of User Location
|
|
4747
4551
|
****************************/
|
|
4748
4552
|
showGeometryByElementId = (elementId) => {
|
|
4749
|
-
const geometry =
|
|
4553
|
+
const geometry = _5.get(
|
|
4750
4554
|
this.#elements,
|
|
4751
4555
|
`${elementId}.geometry`
|
|
4752
4556
|
);
|
|
4753
4557
|
if (geometry) geometry.show();
|
|
4754
4558
|
};
|
|
4755
4559
|
hideGeometryByElementId = (elementId) => {
|
|
4756
|
-
const geometry =
|
|
4560
|
+
const geometry = _5.get(this.#elements, `${elementId}.geometry`);
|
|
4757
4561
|
if (geometry) geometry.hide();
|
|
4758
4562
|
};
|
|
4759
4563
|
setSpriteMarkersOpacity = (opacity = 1) => {
|
|
@@ -4800,13 +4604,13 @@ var IndoorMap = class extends EventTarget {
|
|
|
4800
4604
|
const line = lineStrings[i];
|
|
4801
4605
|
const coords = line.geometry.coordinates;
|
|
4802
4606
|
const prevLine = lineStrings[i - 1];
|
|
4803
|
-
const firstCoord =
|
|
4607
|
+
const firstCoord = _5.first(coords);
|
|
4804
4608
|
const isFirstLine = i === 0;
|
|
4805
4609
|
if (isFirstLine) {
|
|
4806
4610
|
accLine.push(...coords);
|
|
4807
4611
|
continue;
|
|
4808
4612
|
}
|
|
4809
|
-
const prevLastCoord =
|
|
4613
|
+
const prevLastCoord = _5.last(prevLine.geometry.coordinates);
|
|
4810
4614
|
const isNearby = turfDistance(point(firstCoord), point(prevLastCoord)) < distance;
|
|
4811
4615
|
if (!isNearby) {
|
|
4812
4616
|
const remainingLines = lineStrings.slice(i);
|
|
@@ -4827,8 +4631,8 @@ var IndoorMap = class extends EventTarget {
|
|
|
4827
4631
|
create3DStepPath
|
|
4828
4632
|
} = this.#styler;
|
|
4829
4633
|
const routeMarkerLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
|
|
4830
|
-
const linesByOrdinal =
|
|
4831
|
-
const joinedLines =
|
|
4634
|
+
const linesByOrdinal = _5(stepGeometries).filter(({ geometry }) => geometry.type === "LineString").groupBy("properties.ordinal").value();
|
|
4635
|
+
const joinedLines = _5(linesByOrdinal).reduce((acc, lines, key) => {
|
|
4832
4636
|
const joined = this.combineNearbyLineStrings(lines, {
|
|
4833
4637
|
properties: { ordinal: +key }
|
|
4834
4638
|
});
|
|
@@ -4856,14 +4660,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
4856
4660
|
stepElement = createOriginMarker(stepGeometry).addTo(routeMarkerLayer);
|
|
4857
4661
|
break;
|
|
4858
4662
|
case "destination-marker":
|
|
4859
|
-
const extrudeConfig =
|
|
4663
|
+
const extrudeConfig = _5.get(this.#mapConfig, "extrude");
|
|
4860
4664
|
if (destinationFeature.feature_type === "occupant") {
|
|
4861
|
-
const stepId =
|
|
4665
|
+
const stepId = _5.get(stepGeometry, "id");
|
|
4862
4666
|
const normalizedDestinationFeature = {
|
|
4863
4667
|
...destinationFeature,
|
|
4864
4668
|
id: stepId
|
|
4865
4669
|
};
|
|
4866
|
-
const logoUrl =
|
|
4670
|
+
const logoUrl = _5.get(
|
|
4867
4671
|
normalizedDestinationFeature,
|
|
4868
4672
|
"properties.logo.url"
|
|
4869
4673
|
);
|
|
@@ -4908,15 +4712,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4908
4712
|
const routeMarkerLayer = this.map.getLayer(
|
|
4909
4713
|
HIGHLIGHT_LAYER_NAME
|
|
4910
4714
|
);
|
|
4911
|
-
const originMarkerGeometry =
|
|
4715
|
+
const originMarkerGeometry = _5.get(
|
|
4912
4716
|
this.#elements,
|
|
4913
4717
|
`${ORIGIN_MARKER_ID}.geometry`
|
|
4914
4718
|
);
|
|
4915
|
-
const destinationMarkerGeometry =
|
|
4719
|
+
const destinationMarkerGeometry = _5.get(
|
|
4916
4720
|
this.#elements,
|
|
4917
4721
|
`${DESTINATION_MARKER_ID}.geometry`
|
|
4918
4722
|
);
|
|
4919
|
-
const geometriesToRemove =
|
|
4723
|
+
const geometriesToRemove = _5.compact([
|
|
4920
4724
|
originMarkerGeometry,
|
|
4921
4725
|
destinationMarkerGeometry
|
|
4922
4726
|
]);
|
|
@@ -4927,7 +4731,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4927
4731
|
(obj) => !(obj instanceof NavigationPath)
|
|
4928
4732
|
);
|
|
4929
4733
|
const objects = this.#navigationGeometries || {};
|
|
4930
|
-
|
|
4734
|
+
_5.forEach(objects, (obj) => {
|
|
4931
4735
|
if (!obj) return;
|
|
4932
4736
|
this.#navigationGeometries[obj.properties.id] = null;
|
|
4933
4737
|
obj.remove();
|
|
@@ -4964,7 +4768,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4964
4768
|
}
|
|
4965
4769
|
if (this.threeLayer) {
|
|
4966
4770
|
const currentView = this.camera.getView();
|
|
4967
|
-
const objectOpacity =
|
|
4771
|
+
const objectOpacity = _5.clamp(38 - 2 * currentView.zoom, 0, 1);
|
|
4968
4772
|
this.#objects.forEach((object) => {
|
|
4969
4773
|
object.getObject3d().traverse((child) => {
|
|
4970
4774
|
if (child.isMesh) child.material.opacity = objectOpacity;
|
|
@@ -4974,7 +4778,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4974
4778
|
});
|
|
4975
4779
|
if (this.#billboardObjects) {
|
|
4976
4780
|
this.#billboardObjects.forEach((object) => {
|
|
4977
|
-
const objectScale =
|
|
4781
|
+
const objectScale = _5.clamp(
|
|
4978
4782
|
20 - 1 * currentView.zoom,
|
|
4979
4783
|
1,
|
|
4980
4784
|
1.05
|
|
@@ -4983,7 +4787,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4983
4787
|
});
|
|
4984
4788
|
}
|
|
4985
4789
|
if (this.#isLayersFadingOnZoom) {
|
|
4986
|
-
const layerOpacity =
|
|
4790
|
+
const layerOpacity = _5.clamp(1 - objectOpacity, 0, 1);
|
|
4987
4791
|
LAYERS.forEach((layerKey) => {
|
|
4988
4792
|
const layer = this.map.getLayer(layerKey);
|
|
4989
4793
|
if (layer) layer.setOpacity(layerOpacity);
|
|
@@ -5002,18 +4806,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
5002
4806
|
});
|
|
5003
4807
|
}
|
|
5004
4808
|
this.#animationsToRun.forEach(({ callback }) => callback(this));
|
|
5005
|
-
|
|
4809
|
+
TWEEN.update();
|
|
5006
4810
|
requestAnimationFrame(this.render.bind(this));
|
|
5007
4811
|
}
|
|
5008
4812
|
};
|
|
5009
4813
|
export {
|
|
5010
4814
|
ALL_FEATURE_TYPES,
|
|
5011
|
-
ALWAYS_VISIBLE_FEATURE_TYPES,
|
|
5012
4815
|
BASE_LAYER_NAME,
|
|
5013
4816
|
DEFAULT_BASE_URL,
|
|
5014
|
-
DEFAULT_HIGHLIGHT_OPTIONS,
|
|
5015
4817
|
DEFAULT_LOCALE,
|
|
5016
|
-
DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
|
|
5017
4818
|
DESTINATION_MARKER_ID,
|
|
5018
4819
|
GEOJSON_FEATURE_TYPES,
|
|
5019
4820
|
HIGHLIGHT_LAYER_NAME,
|