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.js
CHANGED
|
@@ -30,12 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var index_exports = {};
|
|
31
31
|
__export(index_exports, {
|
|
32
32
|
ALL_FEATURE_TYPES: () => ALL_FEATURE_TYPES,
|
|
33
|
-
ALWAYS_VISIBLE_FEATURE_TYPES: () => ALWAYS_VISIBLE_FEATURE_TYPES,
|
|
34
33
|
BASE_LAYER_NAME: () => BASE_LAYER_NAME,
|
|
35
34
|
DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
|
|
36
|
-
DEFAULT_HIGHLIGHT_OPTIONS: () => DEFAULT_HIGHLIGHT_OPTIONS,
|
|
37
35
|
DEFAULT_LOCALE: () => DEFAULT_LOCALE,
|
|
38
|
-
DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS: () => DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
|
|
39
36
|
DESTINATION_MARKER_ID: () => DESTINATION_MARKER_ID,
|
|
40
37
|
GEOJSON_FEATURE_TYPES: () => GEOJSON_FEATURE_TYPES,
|
|
41
38
|
HIGHLIGHT_LAYER_NAME: () => HIGHLIGHT_LAYER_NAME,
|
|
@@ -771,8 +768,8 @@ var getDataClient = (options) => {
|
|
|
771
768
|
// src/IndoorMap/IndoorMap.ts
|
|
772
769
|
var import_maptalks_gl = require("maptalks-gl");
|
|
773
770
|
var import_transcoders = require("@maptalks/transcoders.draco");
|
|
774
|
-
var
|
|
775
|
-
var
|
|
771
|
+
var import_tween = __toESM(require("@tweenjs/tween.js"));
|
|
772
|
+
var import_lodash6 = __toESM(require("lodash"));
|
|
776
773
|
|
|
777
774
|
// ../../node_modules/@turf/helpers/dist/esm/index.js
|
|
778
775
|
var earthRadius = 63710088e-1;
|
|
@@ -852,7 +849,7 @@ function isNumber(num) {
|
|
|
852
849
|
// src/IndoorMap/IndoorMap.ts
|
|
853
850
|
var import_distance = __toESM(require("@turf/distance"));
|
|
854
851
|
var import_center4 = __toESM(require("@turf/center"));
|
|
855
|
-
var
|
|
852
|
+
var import_three6 = require("three");
|
|
856
853
|
var import_maptalks10 = require("maptalks.three");
|
|
857
854
|
|
|
858
855
|
// src/IndoorMap/constants.ts
|
|
@@ -871,7 +868,6 @@ var GEOLOCATION = "geolocation";
|
|
|
871
868
|
var ORIGIN_MARKER = "origin-marker";
|
|
872
869
|
var DESTINATION_MARKER = "destination-marker";
|
|
873
870
|
var DECORATION = "decoration";
|
|
874
|
-
var ALWAYS_VISIBLE_FEATURE_TYPES = [VENUE, FOOTPRINT];
|
|
875
871
|
var BASE_LAYER_NAME = "base";
|
|
876
872
|
var POI_MARKER_LAYER_NAME = "poi";
|
|
877
873
|
var MARKER_LAYER_NAME = "marker";
|
|
@@ -883,13 +879,6 @@ var USER_LOCATION_ELEMENT_ID = "user_location";
|
|
|
883
879
|
var LAST_USER_LOCATION_ELEMENT_ID_PREFIX = "last_user_location-";
|
|
884
880
|
var LOCALE_SYMBOL_KEY = "locale_symbol";
|
|
885
881
|
var DEFAULT_LOCALE = "en";
|
|
886
|
-
var DEFAULT_HIGHLIGHT_OPTIONS = {
|
|
887
|
-
symbolSet: null
|
|
888
|
-
};
|
|
889
|
-
var DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS = {
|
|
890
|
-
symbolSet: null,
|
|
891
|
-
defaultMarker: false
|
|
892
|
-
};
|
|
893
882
|
var LAYERS = [
|
|
894
883
|
BASE_LAYER_NAME,
|
|
895
884
|
POI_MARKER_LAYER_NAME,
|
|
@@ -2924,45 +2913,6 @@ var getSuitablyValueBetweenBearings = (newBearing, currentBearing) => {
|
|
|
2924
2913
|
return newBearing;
|
|
2925
2914
|
};
|
|
2926
2915
|
|
|
2927
|
-
// src/IndoorMap/utils/createHighlightElement.ts
|
|
2928
|
-
var import_three6 = require("three");
|
|
2929
|
-
var import_lodash5 = __toESM(require("lodash"));
|
|
2930
|
-
var import_tween = __toESM(require("@tweenjs/tween.js"));
|
|
2931
|
-
var DEFAULT_ALTITUDE_FACTOR = 0.5;
|
|
2932
|
-
var createHighlighBillboardController = (obj, { altitudeFactor = DEFAULT_ALTITUDE_FACTOR } = {}) => {
|
|
2933
|
-
const controller = { start: () => {
|
|
2934
|
-
}, clear: () => {
|
|
2935
|
-
} };
|
|
2936
|
-
if (!(obj instanceof Billboard)) return controller;
|
|
2937
|
-
const altitude = obj.properties.default.altitude;
|
|
2938
|
-
const newAltitude = import_lodash5.default.clamp(altitude * altitudeFactor, 0, altitude);
|
|
2939
|
-
const tween = new import_tween.default.Tween({ altitude }).to({ altitude: newAltitude }, 800).easing(import_tween.default.Easing.Quartic.Out).onUpdate((newUpdate) => {
|
|
2940
|
-
obj.setLineHeight(newUpdate.altitude);
|
|
2941
|
-
});
|
|
2942
|
-
controller.start = () => {
|
|
2943
|
-
tween.start();
|
|
2944
|
-
};
|
|
2945
|
-
controller.clear = () => {
|
|
2946
|
-
tween.stop().to({ altitude }, 1600).startFromCurrentValues();
|
|
2947
|
-
};
|
|
2948
|
-
return controller;
|
|
2949
|
-
};
|
|
2950
|
-
var createHighlighExtrudeObjectController = (obj, { color }) => {
|
|
2951
|
-
const controller = { start: () => {
|
|
2952
|
-
}, clear: () => {
|
|
2953
|
-
} };
|
|
2954
|
-
if (obj?.type !== "ExtrudePolygon" || import_lodash5.default.isNil(obj?.object3d?.material?.color) || import_lodash5.default.isNil(color))
|
|
2955
|
-
return controller;
|
|
2956
|
-
controller.start = () => {
|
|
2957
|
-
obj.object3d.material.color = new import_three6.Color(color);
|
|
2958
|
-
};
|
|
2959
|
-
controller.clear = () => {
|
|
2960
|
-
const objectDefaultColor = import_lodash5.default.get(obj, "properties.defaultColor");
|
|
2961
|
-
obj.object3d.material.color = new import_three6.Color(objectDefaultColor);
|
|
2962
|
-
};
|
|
2963
|
-
return controller;
|
|
2964
|
-
};
|
|
2965
|
-
|
|
2966
2916
|
// src/IndoorMap/camera/CameraManager.ts
|
|
2967
2917
|
var import_maptalks6 = require("maptalks");
|
|
2968
2918
|
|
|
@@ -3573,7 +3523,7 @@ var maptalks7 = __toESM(require("maptalks-gl"));
|
|
|
3573
3523
|
var import_maptalks8 = require("maptalks");
|
|
3574
3524
|
var THREE2 = __toESM(require("three"));
|
|
3575
3525
|
var import_maptalks9 = require("maptalks.three");
|
|
3576
|
-
var
|
|
3526
|
+
var import_lodash5 = require("lodash");
|
|
3577
3527
|
|
|
3578
3528
|
// src/IndoorMap/renderer/utils/interpolateStops.ts
|
|
3579
3529
|
var interpolateStops = ({ stops }, zoom) => {
|
|
@@ -3668,7 +3618,7 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
|
|
|
3668
3618
|
const paragraphs = String(text).split("\n");
|
|
3669
3619
|
const wrappedLines = [];
|
|
3670
3620
|
paragraphs.forEach((paragraph) => {
|
|
3671
|
-
if ((0,
|
|
3621
|
+
if ((0, import_lodash5.isNil)(maxWidth) || isNaN(maxWidth)) {
|
|
3672
3622
|
wrappedLines.push(paragraph);
|
|
3673
3623
|
return;
|
|
3674
3624
|
}
|
|
@@ -3729,7 +3679,7 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
|
|
|
3729
3679
|
const altitude = (options.altitude || 0) + this.#altitudeOffset;
|
|
3730
3680
|
const z = layer.altitudeToVector3(altitude, altitude).x;
|
|
3731
3681
|
const position = layer.coordinateToVector3(this._coordinate, z);
|
|
3732
|
-
(0,
|
|
3682
|
+
(0, import_lodash5.set)(this.properties, "default.position", position);
|
|
3733
3683
|
this.getObject3d().position.copy(position);
|
|
3734
3684
|
}
|
|
3735
3685
|
_animation() {
|
|
@@ -4111,6 +4061,7 @@ var INITIAL_ZOOM = 18.5;
|
|
|
4111
4061
|
var CLICK_TOLERANCE = 20;
|
|
4112
4062
|
var defaultOptions = {
|
|
4113
4063
|
pixelRatio: 1,
|
|
4064
|
+
interactions: true,
|
|
4114
4065
|
locale: DEFAULT_LOCALE
|
|
4115
4066
|
};
|
|
4116
4067
|
var IndoorMap = class extends EventTarget {
|
|
@@ -4166,7 +4117,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4166
4117
|
};
|
|
4167
4118
|
constructor(elementId, options) {
|
|
4168
4119
|
super();
|
|
4169
|
-
const combinedOptions =
|
|
4120
|
+
const combinedOptions = import_lodash6.default.merge({}, defaultOptions, options);
|
|
4170
4121
|
this.options = options;
|
|
4171
4122
|
const {
|
|
4172
4123
|
onMapReady,
|
|
@@ -4182,6 +4133,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4182
4133
|
zoom: INITIAL_ZOOM,
|
|
4183
4134
|
clickTimeThreshold: 600,
|
|
4184
4135
|
centerCross: options.centerCross ?? false,
|
|
4136
|
+
...options.interactions === false ? {
|
|
4137
|
+
draggable: false,
|
|
4138
|
+
dragPan: false,
|
|
4139
|
+
dragRotate: false,
|
|
4140
|
+
dragPitch: false,
|
|
4141
|
+
scrollWheelZoom: false,
|
|
4142
|
+
touchZoom: false,
|
|
4143
|
+
doubleClickZoom: false
|
|
4144
|
+
} : {},
|
|
4185
4145
|
baseLayer: new import_maptalks_gl.TileLayer("base", {
|
|
4186
4146
|
urlTemplate: "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
|
|
4187
4147
|
subdomains: ["a", "b", "c", "d"],
|
|
@@ -4231,7 +4191,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4231
4191
|
handleMapClick = ({ coordinate }) => {
|
|
4232
4192
|
const { x, y } = coordinate;
|
|
4233
4193
|
console.log(
|
|
4234
|
-
`[Coordinates]: x: ${
|
|
4194
|
+
`[Coordinates]: x: ${import_lodash6.default.round(x, 8)} y: ${import_lodash6.default.round(
|
|
4235
4195
|
y,
|
|
4236
4196
|
8
|
|
4237
4197
|
)}, [Bearing]: ${this.map.getBearing()}, [Pitch]: ${this.map.getPitch()}`
|
|
@@ -4312,7 +4272,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4312
4272
|
const scene = this.threeLayer.getScene();
|
|
4313
4273
|
if (scene) {
|
|
4314
4274
|
scene.children = scene.children.filter(
|
|
4315
|
-
(children) => children instanceof
|
|
4275
|
+
(children) => children instanceof import_three6.PerspectiveCamera
|
|
4316
4276
|
);
|
|
4317
4277
|
}
|
|
4318
4278
|
}
|
|
@@ -4320,7 +4280,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4320
4280
|
if (this.#isClicked) return;
|
|
4321
4281
|
this.#isClicked = true;
|
|
4322
4282
|
const onClickElement = this.#onClickElement;
|
|
4323
|
-
if (!
|
|
4283
|
+
if (!import_lodash6.default.isFunction(onClickElement)) return;
|
|
4324
4284
|
this.#onClickElement(e);
|
|
4325
4285
|
this.#isClicked = false;
|
|
4326
4286
|
};
|
|
@@ -4348,16 +4308,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
4348
4308
|
for (const feature2 of this.#features) {
|
|
4349
4309
|
try {
|
|
4350
4310
|
const { feature_type: featureType, properties, id } = feature2;
|
|
4351
|
-
const layerName =
|
|
4311
|
+
const layerName = import_lodash6.default.get(
|
|
4352
4312
|
LAYER_FEATURE_TYPE_OBJ,
|
|
4353
4313
|
featureType,
|
|
4354
4314
|
featureType
|
|
4355
4315
|
);
|
|
4356
4316
|
const layer = this.map.getLayer(layerName);
|
|
4357
4317
|
let geometry;
|
|
4358
|
-
const category =
|
|
4359
|
-
const extrudeConfig =
|
|
4360
|
-
const textMarkerType =
|
|
4318
|
+
const category = import_lodash6.default.get(feature2, "properties.category");
|
|
4319
|
+
const extrudeConfig = import_lodash6.default.get(this.#mapConfig, "extrude");
|
|
4320
|
+
const textMarkerType = import_lodash6.default.get(
|
|
4361
4321
|
this.#mapConfig,
|
|
4362
4322
|
"text_marker_type",
|
|
4363
4323
|
"ui-marker"
|
|
@@ -4510,186 +4470,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4510
4470
|
clearAnimations() {
|
|
4511
4471
|
this.#animationsToRun = [];
|
|
4512
4472
|
}
|
|
4513
|
-
/**
|
|
4514
|
-
* Hilighting Elements
|
|
4515
|
-
* ========================================= */
|
|
4516
|
-
// TODO: To consider if we should use setter `set hilightElementIds` instead?
|
|
4517
|
-
setHighlightElementIds(targetElementIds, options = {}) {
|
|
4518
|
-
const highlight3DOptions = import_lodash7.default.merge(
|
|
4519
|
-
{},
|
|
4520
|
-
DEFAULT_HIGHLIGHT_OPTIONS,
|
|
4521
|
-
import_lodash7.default.get(options, "highlight3DOptions", {})
|
|
4522
|
-
);
|
|
4523
|
-
const highlight2DOptions = import_lodash7.default.merge(
|
|
4524
|
-
{},
|
|
4525
|
-
DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
|
|
4526
|
-
import_lodash7.default.get(options, "highlight2DOptions", {})
|
|
4527
|
-
);
|
|
4528
|
-
this.setHighlightedObject(targetElementIds, highlight3DOptions);
|
|
4529
|
-
return this.setHighlight2DElementIds(targetElementIds, highlight2DOptions);
|
|
4530
|
-
}
|
|
4531
|
-
setHighlight2DElementIds(targetElementIds, options = {}) {
|
|
4532
|
-
const { defaultMarker, symbolSet } = import_lodash7.default.merge(
|
|
4533
|
-
{},
|
|
4534
|
-
DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
|
|
4535
|
-
options
|
|
4536
|
-
);
|
|
4537
|
-
const {
|
|
4538
|
-
createMarker,
|
|
4539
|
-
createHighlightOccupantMarker,
|
|
4540
|
-
getElementSymbol,
|
|
4541
|
-
getHilighPolygonalSymbol,
|
|
4542
|
-
getHighlightMarkerSymbol
|
|
4543
|
-
} = this.#styler;
|
|
4544
|
-
const extrudeConfig = import_lodash7.default.get(this.#mapConfig, "extrude");
|
|
4545
|
-
const elementToHilights = targetElementIds.map(
|
|
4546
|
-
(elemId) => this.#elements[elemId] || this.#elements[`${LAST_USER_LOCATION_ELEMENT_ID_PREFIX}${elemId}`]
|
|
4547
|
-
).filter((elem) => elem);
|
|
4548
|
-
elementToHilights.forEach((elem) => {
|
|
4549
|
-
const { feature: feature2, geometry } = elem;
|
|
4550
|
-
if (!geometry || !feature2) return;
|
|
4551
|
-
const hilightLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
|
|
4552
|
-
if (!hilightLayer) return;
|
|
4553
|
-
const defaultSymbol = getHilighPolygonalSymbol(geometry.type);
|
|
4554
|
-
const definedSymbol = symbolSet ? getElementSymbol(symbolSet) : null;
|
|
4555
|
-
const symbol = import_lodash7.default.isEmpty(definedSymbol) ? defaultSymbol : definedSymbol;
|
|
4556
|
-
switch (geometry.type) {
|
|
4557
|
-
case "MultiPolygon":
|
|
4558
|
-
case "Polygon": {
|
|
4559
|
-
geometry?.updateSymbol(symbol);
|
|
4560
|
-
break;
|
|
4561
|
-
}
|
|
4562
|
-
default:
|
|
4563
|
-
break;
|
|
4564
|
-
}
|
|
4565
|
-
switch (feature2.feature_type) {
|
|
4566
|
-
case "amenity":
|
|
4567
|
-
const highlightedAmenityMarker = definedSymbol || getHighlightMarkerSymbol();
|
|
4568
|
-
geometry?.updateSymbol(highlightedAmenityMarker);
|
|
4569
|
-
break;
|
|
4570
|
-
case "occupant": {
|
|
4571
|
-
switch (feature2.properties.category) {
|
|
4572
|
-
case "currencyexchange":
|
|
4573
|
-
case "donationcenter":
|
|
4574
|
-
case "postoffice":
|
|
4575
|
-
const highlightedAmenityMarker2 = definedSymbol || getHighlightMarkerSymbol();
|
|
4576
|
-
geometry?.updateSymbol(highlightedAmenityMarker2);
|
|
4577
|
-
break;
|
|
4578
|
-
default:
|
|
4579
|
-
if (feature2.properties.render_type === "Logo") {
|
|
4580
|
-
this.hideGeometryByElementId(feature2.id);
|
|
4581
|
-
}
|
|
4582
|
-
createHighlightOccupantMarker(feature2, {
|
|
4583
|
-
extrudeConfig,
|
|
4584
|
-
symbol: definedSymbol
|
|
4585
|
-
}).on("click", this.handleClickElement).addTo(hilightLayer);
|
|
4586
|
-
break;
|
|
4587
|
-
}
|
|
4588
|
-
break;
|
|
4589
|
-
}
|
|
4590
|
-
case "opening":
|
|
4591
|
-
break;
|
|
4592
|
-
default:
|
|
4593
|
-
if (defaultMarker) createMarker(feature2).addTo(hilightLayer);
|
|
4594
|
-
break;
|
|
4595
|
-
}
|
|
4596
|
-
});
|
|
4597
|
-
this.#highlightElementIds = targetElementIds;
|
|
4598
|
-
if (elementToHilights.length === 0) return;
|
|
4599
|
-
return featureCollection(
|
|
4600
|
-
elementToHilights.map(({ feature: feature2 }) => {
|
|
4601
|
-
const { geometry } = feature2;
|
|
4602
|
-
if (feature2.feature_type === "occupant")
|
|
4603
|
-
return feature(feature2?.properties?.anchor?.geometry);
|
|
4604
|
-
return feature(geometry);
|
|
4605
|
-
})
|
|
4606
|
-
);
|
|
4607
|
-
}
|
|
4608
|
-
clearHighlightElements() {
|
|
4609
|
-
this.#clearAllElementOnLayerByName(HIGHLIGHT_LAYER_NAME);
|
|
4610
|
-
(0, import_lodash7.default)(this.#highlightElementIds).map((elemId) => this.#elements[elemId]?.geometry).compact().forEach((geometry) => {
|
|
4611
|
-
if (geometry instanceof import_maptalks_gl.ui.UIMarker) return;
|
|
4612
|
-
if (geometry instanceof import_maptalks_gl.Marker) {
|
|
4613
|
-
this.showGeometryByElementId(geometry.properties.id);
|
|
4614
|
-
return;
|
|
4615
|
-
}
|
|
4616
|
-
try {
|
|
4617
|
-
const defaultSymbol = geometry.options.defaultSymbol;
|
|
4618
|
-
geometry.updateSymbol(defaultSymbol);
|
|
4619
|
-
} catch (err) {
|
|
4620
|
-
console.log(
|
|
4621
|
-
`error cannot return to defaultSymbol, check if "defaultSymbol" exists in element creation function`
|
|
4622
|
-
);
|
|
4623
|
-
}
|
|
4624
|
-
});
|
|
4625
|
-
this.#highlightElementIds = [];
|
|
4626
|
-
}
|
|
4627
|
-
setHighlightedObject(targetObjectIds, options = {}) {
|
|
4628
|
-
const { symbolSet } = import_lodash7.default.merge({}, DEFAULT_HIGHLIGHT_OPTIONS, options);
|
|
4629
|
-
const {
|
|
4630
|
-
getElementSymbol,
|
|
4631
|
-
getHilighPolygonalSymbol,
|
|
4632
|
-
createHighlight2DAmenityMarkerFrom3DMarker
|
|
4633
|
-
} = this.#styler;
|
|
4634
|
-
const objects = this.threeLayer?.getBaseObjects();
|
|
4635
|
-
const objectsToHighlight = objects.filter(
|
|
4636
|
-
({ properties }) => targetObjectIds.includes(properties?.id)
|
|
4637
|
-
);
|
|
4638
|
-
const defaultSymbol = getHilighPolygonalSymbol("Polygon");
|
|
4639
|
-
const targetSymbol = symbolSet ? getElementSymbol(symbolSet) : null;
|
|
4640
|
-
const { polygonFill: color } = import_lodash7.default.isEmpty(targetSymbol) ? defaultSymbol : targetSymbol;
|
|
4641
|
-
const amenityHighlightMode = import_lodash7.default.get(
|
|
4642
|
-
this.#mapConfig,
|
|
4643
|
-
"amenity_highlight_mode",
|
|
4644
|
-
""
|
|
4645
|
-
);
|
|
4646
|
-
objectsToHighlight.forEach((obj) => {
|
|
4647
|
-
if (obj.type === "ExtrudePolygon") {
|
|
4648
|
-
const newController = createHighlighExtrudeObjectController(obj, {
|
|
4649
|
-
color
|
|
4650
|
-
});
|
|
4651
|
-
newController.start();
|
|
4652
|
-
this.#highlightObjectControllers.push(newController);
|
|
4653
|
-
}
|
|
4654
|
-
if (obj instanceof SpriteMarker) {
|
|
4655
|
-
if (amenityHighlightMode === "2DMarker") {
|
|
4656
|
-
const hilight2DLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
|
|
4657
|
-
const extrudeConfig = import_lodash7.default.get(this.#mapConfig, "extrude");
|
|
4658
|
-
obj.hide();
|
|
4659
|
-
const { properties: featureProperties } = obj;
|
|
4660
|
-
createHighlight2DAmenityMarkerFrom3DMarker(
|
|
4661
|
-
featureProperties,
|
|
4662
|
-
extrudeConfig
|
|
4663
|
-
).on("click", this.handleClickElement).addTo(hilight2DLayer);
|
|
4664
|
-
} else {
|
|
4665
|
-
obj.highlight();
|
|
4666
|
-
}
|
|
4667
|
-
}
|
|
4668
|
-
if (obj instanceof Billboard) {
|
|
4669
|
-
const newController = createHighlighBillboardController(obj);
|
|
4670
|
-
newController.start();
|
|
4671
|
-
this.#highlightObjectControllers.push(newController);
|
|
4672
|
-
}
|
|
4673
|
-
});
|
|
4674
|
-
this.#highlightObjectIds = targetObjectIds;
|
|
4675
|
-
}
|
|
4676
|
-
clearHighlightObject() {
|
|
4677
|
-
this.#highlightObjectControllers.forEach((controller) => {
|
|
4678
|
-
if (import_lodash7.default.isFunction(controller?.clear)) controller.clear();
|
|
4679
|
-
});
|
|
4680
|
-
this.#highlightObjectIds.forEach((objIds) => {
|
|
4681
|
-
const objects = this.threeLayer?.getBaseObjects();
|
|
4682
|
-
const objectToResetHighlight = objects.find(
|
|
4683
|
-
({ properties }) => objIds.includes(properties?.id)
|
|
4684
|
-
);
|
|
4685
|
-
if (objectToResetHighlight instanceof SpriteMarker) {
|
|
4686
|
-
objectToResetHighlight.show();
|
|
4687
|
-
objectToResetHighlight.removeHighlight();
|
|
4688
|
-
}
|
|
4689
|
-
});
|
|
4690
|
-
this.#highlightObjectControllers = [];
|
|
4691
|
-
this.#highlightObjectIds = [];
|
|
4692
|
-
}
|
|
4693
4473
|
/**
|
|
4694
4474
|
* User Location
|
|
4695
4475
|
****************************/
|
|
@@ -4714,15 +4494,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4714
4494
|
}
|
|
4715
4495
|
}
|
|
4716
4496
|
updateUserLocationSymbolByLocale(locale) {
|
|
4717
|
-
const userLocationGeometry =
|
|
4497
|
+
const userLocationGeometry = import_lodash6.default.get(
|
|
4718
4498
|
this.#elements,
|
|
4719
4499
|
`${USER_LOCATION_ELEMENT_ID}.geometry`
|
|
4720
4500
|
);
|
|
4721
4501
|
if (!userLocationGeometry) return;
|
|
4722
4502
|
const currentSymbol = userLocationGeometry.getSymbol();
|
|
4723
4503
|
const localeSymbolToUpdate = currentSymbol.map((symbol) => {
|
|
4724
|
-
const localeSymbol =
|
|
4725
|
-
if (!
|
|
4504
|
+
const localeSymbol = import_lodash6.default.get(symbol, `${LOCALE_SYMBOL_KEY}.${locale}`) || import_lodash6.default.get(symbol, `${LOCALE_SYMBOL_KEY}.default`);
|
|
4505
|
+
if (!import_lodash6.default.isPlainObject(localeSymbol)) return symbol;
|
|
4726
4506
|
return {
|
|
4727
4507
|
...symbol,
|
|
4728
4508
|
...localeSymbol
|
|
@@ -4796,14 +4576,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
4796
4576
|
* END of User Location
|
|
4797
4577
|
****************************/
|
|
4798
4578
|
showGeometryByElementId = (elementId) => {
|
|
4799
|
-
const geometry =
|
|
4579
|
+
const geometry = import_lodash6.default.get(
|
|
4800
4580
|
this.#elements,
|
|
4801
4581
|
`${elementId}.geometry`
|
|
4802
4582
|
);
|
|
4803
4583
|
if (geometry) geometry.show();
|
|
4804
4584
|
};
|
|
4805
4585
|
hideGeometryByElementId = (elementId) => {
|
|
4806
|
-
const geometry =
|
|
4586
|
+
const geometry = import_lodash6.default.get(this.#elements, `${elementId}.geometry`);
|
|
4807
4587
|
if (geometry) geometry.hide();
|
|
4808
4588
|
};
|
|
4809
4589
|
setSpriteMarkersOpacity = (opacity = 1) => {
|
|
@@ -4850,13 +4630,13 @@ var IndoorMap = class extends EventTarget {
|
|
|
4850
4630
|
const line = lineStrings[i];
|
|
4851
4631
|
const coords = line.geometry.coordinates;
|
|
4852
4632
|
const prevLine = lineStrings[i - 1];
|
|
4853
|
-
const firstCoord =
|
|
4633
|
+
const firstCoord = import_lodash6.default.first(coords);
|
|
4854
4634
|
const isFirstLine = i === 0;
|
|
4855
4635
|
if (isFirstLine) {
|
|
4856
4636
|
accLine.push(...coords);
|
|
4857
4637
|
continue;
|
|
4858
4638
|
}
|
|
4859
|
-
const prevLastCoord =
|
|
4639
|
+
const prevLastCoord = import_lodash6.default.last(prevLine.geometry.coordinates);
|
|
4860
4640
|
const isNearby = (0, import_distance.default)(point(firstCoord), point(prevLastCoord)) < distance;
|
|
4861
4641
|
if (!isNearby) {
|
|
4862
4642
|
const remainingLines = lineStrings.slice(i);
|
|
@@ -4877,8 +4657,8 @@ var IndoorMap = class extends EventTarget {
|
|
|
4877
4657
|
create3DStepPath
|
|
4878
4658
|
} = this.#styler;
|
|
4879
4659
|
const routeMarkerLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
|
|
4880
|
-
const linesByOrdinal = (0,
|
|
4881
|
-
const joinedLines = (0,
|
|
4660
|
+
const linesByOrdinal = (0, import_lodash6.default)(stepGeometries).filter(({ geometry }) => geometry.type === "LineString").groupBy("properties.ordinal").value();
|
|
4661
|
+
const joinedLines = (0, import_lodash6.default)(linesByOrdinal).reduce((acc, lines, key) => {
|
|
4882
4662
|
const joined = this.combineNearbyLineStrings(lines, {
|
|
4883
4663
|
properties: { ordinal: +key }
|
|
4884
4664
|
});
|
|
@@ -4906,14 +4686,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
4906
4686
|
stepElement = createOriginMarker(stepGeometry).addTo(routeMarkerLayer);
|
|
4907
4687
|
break;
|
|
4908
4688
|
case "destination-marker":
|
|
4909
|
-
const extrudeConfig =
|
|
4689
|
+
const extrudeConfig = import_lodash6.default.get(this.#mapConfig, "extrude");
|
|
4910
4690
|
if (destinationFeature.feature_type === "occupant") {
|
|
4911
|
-
const stepId =
|
|
4691
|
+
const stepId = import_lodash6.default.get(stepGeometry, "id");
|
|
4912
4692
|
const normalizedDestinationFeature = {
|
|
4913
4693
|
...destinationFeature,
|
|
4914
4694
|
id: stepId
|
|
4915
4695
|
};
|
|
4916
|
-
const logoUrl =
|
|
4696
|
+
const logoUrl = import_lodash6.default.get(
|
|
4917
4697
|
normalizedDestinationFeature,
|
|
4918
4698
|
"properties.logo.url"
|
|
4919
4699
|
);
|
|
@@ -4958,15 +4738,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4958
4738
|
const routeMarkerLayer = this.map.getLayer(
|
|
4959
4739
|
HIGHLIGHT_LAYER_NAME
|
|
4960
4740
|
);
|
|
4961
|
-
const originMarkerGeometry =
|
|
4741
|
+
const originMarkerGeometry = import_lodash6.default.get(
|
|
4962
4742
|
this.#elements,
|
|
4963
4743
|
`${ORIGIN_MARKER_ID}.geometry`
|
|
4964
4744
|
);
|
|
4965
|
-
const destinationMarkerGeometry =
|
|
4745
|
+
const destinationMarkerGeometry = import_lodash6.default.get(
|
|
4966
4746
|
this.#elements,
|
|
4967
4747
|
`${DESTINATION_MARKER_ID}.geometry`
|
|
4968
4748
|
);
|
|
4969
|
-
const geometriesToRemove =
|
|
4749
|
+
const geometriesToRemove = import_lodash6.default.compact([
|
|
4970
4750
|
originMarkerGeometry,
|
|
4971
4751
|
destinationMarkerGeometry
|
|
4972
4752
|
]);
|
|
@@ -4977,7 +4757,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4977
4757
|
(obj) => !(obj instanceof NavigationPath)
|
|
4978
4758
|
);
|
|
4979
4759
|
const objects = this.#navigationGeometries || {};
|
|
4980
|
-
|
|
4760
|
+
import_lodash6.default.forEach(objects, (obj) => {
|
|
4981
4761
|
if (!obj) return;
|
|
4982
4762
|
this.#navigationGeometries[obj.properties.id] = null;
|
|
4983
4763
|
obj.remove();
|
|
@@ -5014,7 +4794,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5014
4794
|
}
|
|
5015
4795
|
if (this.threeLayer) {
|
|
5016
4796
|
const currentView = this.camera.getView();
|
|
5017
|
-
const objectOpacity =
|
|
4797
|
+
const objectOpacity = import_lodash6.default.clamp(38 - 2 * currentView.zoom, 0, 1);
|
|
5018
4798
|
this.#objects.forEach((object) => {
|
|
5019
4799
|
object.getObject3d().traverse((child) => {
|
|
5020
4800
|
if (child.isMesh) child.material.opacity = objectOpacity;
|
|
@@ -5024,7 +4804,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5024
4804
|
});
|
|
5025
4805
|
if (this.#billboardObjects) {
|
|
5026
4806
|
this.#billboardObjects.forEach((object) => {
|
|
5027
|
-
const objectScale =
|
|
4807
|
+
const objectScale = import_lodash6.default.clamp(
|
|
5028
4808
|
20 - 1 * currentView.zoom,
|
|
5029
4809
|
1,
|
|
5030
4810
|
1.05
|
|
@@ -5033,7 +4813,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5033
4813
|
});
|
|
5034
4814
|
}
|
|
5035
4815
|
if (this.#isLayersFadingOnZoom) {
|
|
5036
|
-
const layerOpacity =
|
|
4816
|
+
const layerOpacity = import_lodash6.default.clamp(1 - objectOpacity, 0, 1);
|
|
5037
4817
|
LAYERS.forEach((layerKey) => {
|
|
5038
4818
|
const layer = this.map.getLayer(layerKey);
|
|
5039
4819
|
if (layer) layer.setOpacity(layerOpacity);
|
|
@@ -5052,19 +4832,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
5052
4832
|
});
|
|
5053
4833
|
}
|
|
5054
4834
|
this.#animationsToRun.forEach(({ callback }) => callback(this));
|
|
5055
|
-
|
|
4835
|
+
import_tween.default.update();
|
|
5056
4836
|
requestAnimationFrame(this.render.bind(this));
|
|
5057
4837
|
}
|
|
5058
4838
|
};
|
|
5059
4839
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5060
4840
|
0 && (module.exports = {
|
|
5061
4841
|
ALL_FEATURE_TYPES,
|
|
5062
|
-
ALWAYS_VISIBLE_FEATURE_TYPES,
|
|
5063
4842
|
BASE_LAYER_NAME,
|
|
5064
4843
|
DEFAULT_BASE_URL,
|
|
5065
|
-
DEFAULT_HIGHLIGHT_OPTIONS,
|
|
5066
4844
|
DEFAULT_LOCALE,
|
|
5067
|
-
DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
|
|
5068
4845
|
DESTINATION_MARKER_ID,
|
|
5069
4846
|
GEOJSON_FEATURE_TYPES,
|
|
5070
4847
|
HIGHLIGHT_LAYER_NAME,
|