venue-js 1.2.0-next.10 → 1.2.0-next.11
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 +4 -22
- package/dist/index.d.ts +4 -22
- package/dist/index.js +44 -267
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -261
- 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
|
|
|
@@ -4061,6 +4012,7 @@ var INITIAL_ZOOM = 18.5;
|
|
|
4061
4012
|
var CLICK_TOLERANCE = 20;
|
|
4062
4013
|
var defaultOptions = {
|
|
4063
4014
|
pixelRatio: 1,
|
|
4015
|
+
interactions: true,
|
|
4064
4016
|
locale: DEFAULT_LOCALE
|
|
4065
4017
|
};
|
|
4066
4018
|
var IndoorMap = class extends EventTarget {
|
|
@@ -4116,7 +4068,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4116
4068
|
};
|
|
4117
4069
|
constructor(elementId, options) {
|
|
4118
4070
|
super();
|
|
4119
|
-
const combinedOptions =
|
|
4071
|
+
const combinedOptions = _5.merge({}, defaultOptions, options);
|
|
4120
4072
|
this.options = options;
|
|
4121
4073
|
const {
|
|
4122
4074
|
onMapReady,
|
|
@@ -4132,6 +4084,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4132
4084
|
zoom: INITIAL_ZOOM,
|
|
4133
4085
|
clickTimeThreshold: 600,
|
|
4134
4086
|
centerCross: options.centerCross ?? false,
|
|
4087
|
+
...options.interactions === false ? {
|
|
4088
|
+
draggable: false,
|
|
4089
|
+
dragPan: false,
|
|
4090
|
+
dragRotate: false,
|
|
4091
|
+
dragPitch: false,
|
|
4092
|
+
scrollWheelZoom: false,
|
|
4093
|
+
touchZoom: false,
|
|
4094
|
+
doubleClickZoom: false
|
|
4095
|
+
} : {},
|
|
4135
4096
|
baseLayer: new TileLayer("base", {
|
|
4136
4097
|
urlTemplate: "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
|
|
4137
4098
|
subdomains: ["a", "b", "c", "d"],
|
|
@@ -4181,7 +4142,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4181
4142
|
handleMapClick = ({ coordinate }) => {
|
|
4182
4143
|
const { x, y } = coordinate;
|
|
4183
4144
|
console.log(
|
|
4184
|
-
`[Coordinates]: x: ${
|
|
4145
|
+
`[Coordinates]: x: ${_5.round(x, 8)} y: ${_5.round(
|
|
4185
4146
|
y,
|
|
4186
4147
|
8
|
|
4187
4148
|
)}, [Bearing]: ${this.map.getBearing()}, [Pitch]: ${this.map.getPitch()}`
|
|
@@ -4270,7 +4231,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4270
4231
|
if (this.#isClicked) return;
|
|
4271
4232
|
this.#isClicked = true;
|
|
4272
4233
|
const onClickElement = this.#onClickElement;
|
|
4273
|
-
if (!
|
|
4234
|
+
if (!_5.isFunction(onClickElement)) return;
|
|
4274
4235
|
this.#onClickElement(e);
|
|
4275
4236
|
this.#isClicked = false;
|
|
4276
4237
|
};
|
|
@@ -4298,16 +4259,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
4298
4259
|
for (const feature2 of this.#features) {
|
|
4299
4260
|
try {
|
|
4300
4261
|
const { feature_type: featureType, properties, id } = feature2;
|
|
4301
|
-
const layerName =
|
|
4262
|
+
const layerName = _5.get(
|
|
4302
4263
|
LAYER_FEATURE_TYPE_OBJ,
|
|
4303
4264
|
featureType,
|
|
4304
4265
|
featureType
|
|
4305
4266
|
);
|
|
4306
4267
|
const layer = this.map.getLayer(layerName);
|
|
4307
4268
|
let geometry;
|
|
4308
|
-
const category =
|
|
4309
|
-
const extrudeConfig =
|
|
4310
|
-
const textMarkerType =
|
|
4269
|
+
const category = _5.get(feature2, "properties.category");
|
|
4270
|
+
const extrudeConfig = _5.get(this.#mapConfig, "extrude");
|
|
4271
|
+
const textMarkerType = _5.get(
|
|
4311
4272
|
this.#mapConfig,
|
|
4312
4273
|
"text_marker_type",
|
|
4313
4274
|
"ui-marker"
|
|
@@ -4460,186 +4421,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4460
4421
|
clearAnimations() {
|
|
4461
4422
|
this.#animationsToRun = [];
|
|
4462
4423
|
}
|
|
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
4424
|
/**
|
|
4644
4425
|
* User Location
|
|
4645
4426
|
****************************/
|
|
@@ -4664,15 +4445,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4664
4445
|
}
|
|
4665
4446
|
}
|
|
4666
4447
|
updateUserLocationSymbolByLocale(locale) {
|
|
4667
|
-
const userLocationGeometry =
|
|
4448
|
+
const userLocationGeometry = _5.get(
|
|
4668
4449
|
this.#elements,
|
|
4669
4450
|
`${USER_LOCATION_ELEMENT_ID}.geometry`
|
|
4670
4451
|
);
|
|
4671
4452
|
if (!userLocationGeometry) return;
|
|
4672
4453
|
const currentSymbol = userLocationGeometry.getSymbol();
|
|
4673
4454
|
const localeSymbolToUpdate = currentSymbol.map((symbol) => {
|
|
4674
|
-
const localeSymbol =
|
|
4675
|
-
if (!
|
|
4455
|
+
const localeSymbol = _5.get(symbol, `${LOCALE_SYMBOL_KEY}.${locale}`) || _5.get(symbol, `${LOCALE_SYMBOL_KEY}.default`);
|
|
4456
|
+
if (!_5.isPlainObject(localeSymbol)) return symbol;
|
|
4676
4457
|
return {
|
|
4677
4458
|
...symbol,
|
|
4678
4459
|
...localeSymbol
|
|
@@ -4746,14 +4527,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
4746
4527
|
* END of User Location
|
|
4747
4528
|
****************************/
|
|
4748
4529
|
showGeometryByElementId = (elementId) => {
|
|
4749
|
-
const geometry =
|
|
4530
|
+
const geometry = _5.get(
|
|
4750
4531
|
this.#elements,
|
|
4751
4532
|
`${elementId}.geometry`
|
|
4752
4533
|
);
|
|
4753
4534
|
if (geometry) geometry.show();
|
|
4754
4535
|
};
|
|
4755
4536
|
hideGeometryByElementId = (elementId) => {
|
|
4756
|
-
const geometry =
|
|
4537
|
+
const geometry = _5.get(this.#elements, `${elementId}.geometry`);
|
|
4757
4538
|
if (geometry) geometry.hide();
|
|
4758
4539
|
};
|
|
4759
4540
|
setSpriteMarkersOpacity = (opacity = 1) => {
|
|
@@ -4800,13 +4581,13 @@ var IndoorMap = class extends EventTarget {
|
|
|
4800
4581
|
const line = lineStrings[i];
|
|
4801
4582
|
const coords = line.geometry.coordinates;
|
|
4802
4583
|
const prevLine = lineStrings[i - 1];
|
|
4803
|
-
const firstCoord =
|
|
4584
|
+
const firstCoord = _5.first(coords);
|
|
4804
4585
|
const isFirstLine = i === 0;
|
|
4805
4586
|
if (isFirstLine) {
|
|
4806
4587
|
accLine.push(...coords);
|
|
4807
4588
|
continue;
|
|
4808
4589
|
}
|
|
4809
|
-
const prevLastCoord =
|
|
4590
|
+
const prevLastCoord = _5.last(prevLine.geometry.coordinates);
|
|
4810
4591
|
const isNearby = turfDistance(point(firstCoord), point(prevLastCoord)) < distance;
|
|
4811
4592
|
if (!isNearby) {
|
|
4812
4593
|
const remainingLines = lineStrings.slice(i);
|
|
@@ -4827,8 +4608,8 @@ var IndoorMap = class extends EventTarget {
|
|
|
4827
4608
|
create3DStepPath
|
|
4828
4609
|
} = this.#styler;
|
|
4829
4610
|
const routeMarkerLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
|
|
4830
|
-
const linesByOrdinal =
|
|
4831
|
-
const joinedLines =
|
|
4611
|
+
const linesByOrdinal = _5(stepGeometries).filter(({ geometry }) => geometry.type === "LineString").groupBy("properties.ordinal").value();
|
|
4612
|
+
const joinedLines = _5(linesByOrdinal).reduce((acc, lines, key) => {
|
|
4832
4613
|
const joined = this.combineNearbyLineStrings(lines, {
|
|
4833
4614
|
properties: { ordinal: +key }
|
|
4834
4615
|
});
|
|
@@ -4856,14 +4637,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
4856
4637
|
stepElement = createOriginMarker(stepGeometry).addTo(routeMarkerLayer);
|
|
4857
4638
|
break;
|
|
4858
4639
|
case "destination-marker":
|
|
4859
|
-
const extrudeConfig =
|
|
4640
|
+
const extrudeConfig = _5.get(this.#mapConfig, "extrude");
|
|
4860
4641
|
if (destinationFeature.feature_type === "occupant") {
|
|
4861
|
-
const stepId =
|
|
4642
|
+
const stepId = _5.get(stepGeometry, "id");
|
|
4862
4643
|
const normalizedDestinationFeature = {
|
|
4863
4644
|
...destinationFeature,
|
|
4864
4645
|
id: stepId
|
|
4865
4646
|
};
|
|
4866
|
-
const logoUrl =
|
|
4647
|
+
const logoUrl = _5.get(
|
|
4867
4648
|
normalizedDestinationFeature,
|
|
4868
4649
|
"properties.logo.url"
|
|
4869
4650
|
);
|
|
@@ -4908,15 +4689,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4908
4689
|
const routeMarkerLayer = this.map.getLayer(
|
|
4909
4690
|
HIGHLIGHT_LAYER_NAME
|
|
4910
4691
|
);
|
|
4911
|
-
const originMarkerGeometry =
|
|
4692
|
+
const originMarkerGeometry = _5.get(
|
|
4912
4693
|
this.#elements,
|
|
4913
4694
|
`${ORIGIN_MARKER_ID}.geometry`
|
|
4914
4695
|
);
|
|
4915
|
-
const destinationMarkerGeometry =
|
|
4696
|
+
const destinationMarkerGeometry = _5.get(
|
|
4916
4697
|
this.#elements,
|
|
4917
4698
|
`${DESTINATION_MARKER_ID}.geometry`
|
|
4918
4699
|
);
|
|
4919
|
-
const geometriesToRemove =
|
|
4700
|
+
const geometriesToRemove = _5.compact([
|
|
4920
4701
|
originMarkerGeometry,
|
|
4921
4702
|
destinationMarkerGeometry
|
|
4922
4703
|
]);
|
|
@@ -4927,7 +4708,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4927
4708
|
(obj) => !(obj instanceof NavigationPath)
|
|
4928
4709
|
);
|
|
4929
4710
|
const objects = this.#navigationGeometries || {};
|
|
4930
|
-
|
|
4711
|
+
_5.forEach(objects, (obj) => {
|
|
4931
4712
|
if (!obj) return;
|
|
4932
4713
|
this.#navigationGeometries[obj.properties.id] = null;
|
|
4933
4714
|
obj.remove();
|
|
@@ -4964,7 +4745,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4964
4745
|
}
|
|
4965
4746
|
if (this.threeLayer) {
|
|
4966
4747
|
const currentView = this.camera.getView();
|
|
4967
|
-
const objectOpacity =
|
|
4748
|
+
const objectOpacity = _5.clamp(38 - 2 * currentView.zoom, 0, 1);
|
|
4968
4749
|
this.#objects.forEach((object) => {
|
|
4969
4750
|
object.getObject3d().traverse((child) => {
|
|
4970
4751
|
if (child.isMesh) child.material.opacity = objectOpacity;
|
|
@@ -4974,7 +4755,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4974
4755
|
});
|
|
4975
4756
|
if (this.#billboardObjects) {
|
|
4976
4757
|
this.#billboardObjects.forEach((object) => {
|
|
4977
|
-
const objectScale =
|
|
4758
|
+
const objectScale = _5.clamp(
|
|
4978
4759
|
20 - 1 * currentView.zoom,
|
|
4979
4760
|
1,
|
|
4980
4761
|
1.05
|
|
@@ -4983,7 +4764,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4983
4764
|
});
|
|
4984
4765
|
}
|
|
4985
4766
|
if (this.#isLayersFadingOnZoom) {
|
|
4986
|
-
const layerOpacity =
|
|
4767
|
+
const layerOpacity = _5.clamp(1 - objectOpacity, 0, 1);
|
|
4987
4768
|
LAYERS.forEach((layerKey) => {
|
|
4988
4769
|
const layer = this.map.getLayer(layerKey);
|
|
4989
4770
|
if (layer) layer.setOpacity(layerOpacity);
|
|
@@ -5002,18 +4783,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
5002
4783
|
});
|
|
5003
4784
|
}
|
|
5004
4785
|
this.#animationsToRun.forEach(({ callback }) => callback(this));
|
|
5005
|
-
|
|
4786
|
+
TWEEN.update();
|
|
5006
4787
|
requestAnimationFrame(this.render.bind(this));
|
|
5007
4788
|
}
|
|
5008
4789
|
};
|
|
5009
4790
|
export {
|
|
5010
4791
|
ALL_FEATURE_TYPES,
|
|
5011
|
-
ALWAYS_VISIBLE_FEATURE_TYPES,
|
|
5012
4792
|
BASE_LAYER_NAME,
|
|
5013
4793
|
DEFAULT_BASE_URL,
|
|
5014
|
-
DEFAULT_HIGHLIGHT_OPTIONS,
|
|
5015
4794
|
DEFAULT_LOCALE,
|
|
5016
|
-
DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
|
|
5017
4795
|
DESTINATION_MARKER_ID,
|
|
5018
4796
|
GEOJSON_FEATURE_TYPES,
|
|
5019
4797
|
HIGHLIGHT_LAYER_NAME,
|