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.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
|
|
|
@@ -3185,7 +3135,8 @@ var element3DRendererOptions = {
|
|
|
3185
3135
|
default: { color: "#ffffff", height: 0.5 },
|
|
3186
3136
|
byCategory: {
|
|
3187
3137
|
water: { color: "#ACD7EC", height: 0.1 },
|
|
3188
|
-
vegetation: { color: "#91C499", height: 0.5 }
|
|
3138
|
+
vegetation: { color: "#91C499", height: 0.5 },
|
|
3139
|
+
wall: { color: "#787878", topColor: "#ffffff", height: 4.2, width: 1 }
|
|
3189
3140
|
}
|
|
3190
3141
|
}
|
|
3191
3142
|
};
|
|
@@ -3292,6 +3243,20 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3292
3243
|
return [];
|
|
3293
3244
|
}
|
|
3294
3245
|
};
|
|
3246
|
+
const createLineString = (geometry, feature3) => {
|
|
3247
|
+
try {
|
|
3248
|
+
const color = feature3.properties.style.polygonFill ?? colorOptions ?? "#000000";
|
|
3249
|
+
const material = this.getOrCreateMaterialByColor(color);
|
|
3250
|
+
const extrudedLine = this.threeLayer.toExtrudeLine(
|
|
3251
|
+
new maptalks4.LineString(geometry.coordinates),
|
|
3252
|
+
{ height: heightOptions, ...options },
|
|
3253
|
+
material
|
|
3254
|
+
);
|
|
3255
|
+
return [extrudedLine];
|
|
3256
|
+
} catch (err) {
|
|
3257
|
+
return [];
|
|
3258
|
+
}
|
|
3259
|
+
};
|
|
3295
3260
|
try {
|
|
3296
3261
|
switch (feature2.geometry.type) {
|
|
3297
3262
|
case "MultiPolygon": {
|
|
@@ -3311,6 +3276,13 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3311
3276
|
this.threeLayer.addMesh(meshes);
|
|
3312
3277
|
return meshes;
|
|
3313
3278
|
}
|
|
3279
|
+
case "LineString": {
|
|
3280
|
+
const { coordinates } = feature2.geometry;
|
|
3281
|
+
if (!coordinates) return [];
|
|
3282
|
+
const meshes = createLineString(feature2.geometry, feature2);
|
|
3283
|
+
this.threeLayer.addMesh(meshes);
|
|
3284
|
+
return meshes;
|
|
3285
|
+
}
|
|
3314
3286
|
}
|
|
3315
3287
|
} catch (err) {
|
|
3316
3288
|
console.log(`error createGeometry`, err, { feature: feature2, options });
|
|
@@ -3373,7 +3345,8 @@ var Element3DRenderer = class extends EventTarget {
|
|
|
3373
3345
|
return null;
|
|
3374
3346
|
}
|
|
3375
3347
|
switch (element.type) {
|
|
3376
|
-
case "ExtrudePolygon":
|
|
3348
|
+
case "ExtrudePolygon":
|
|
3349
|
+
case "ExtrudeLine": {
|
|
3377
3350
|
const mesh = element.getObject3d();
|
|
3378
3351
|
const originalMaterial = mesh.material;
|
|
3379
3352
|
const highlightMaterial = this.getOrCreateMaterialByColor("#ff0000");
|
|
@@ -3573,7 +3546,7 @@ var maptalks7 = __toESM(require("maptalks-gl"));
|
|
|
3573
3546
|
var import_maptalks8 = require("maptalks");
|
|
3574
3547
|
var THREE2 = __toESM(require("three"));
|
|
3575
3548
|
var import_maptalks9 = require("maptalks.three");
|
|
3576
|
-
var
|
|
3549
|
+
var import_lodash5 = require("lodash");
|
|
3577
3550
|
|
|
3578
3551
|
// src/IndoorMap/renderer/utils/interpolateStops.ts
|
|
3579
3552
|
var interpolateStops = ({ stops }, zoom) => {
|
|
@@ -3668,7 +3641,7 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
|
|
|
3668
3641
|
const paragraphs = String(text).split("\n");
|
|
3669
3642
|
const wrappedLines = [];
|
|
3670
3643
|
paragraphs.forEach((paragraph) => {
|
|
3671
|
-
if ((0,
|
|
3644
|
+
if ((0, import_lodash5.isNil)(maxWidth) || isNaN(maxWidth)) {
|
|
3672
3645
|
wrappedLines.push(paragraph);
|
|
3673
3646
|
return;
|
|
3674
3647
|
}
|
|
@@ -3729,7 +3702,7 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
|
|
|
3729
3702
|
const altitude = (options.altitude || 0) + this.#altitudeOffset;
|
|
3730
3703
|
const z = layer.altitudeToVector3(altitude, altitude).x;
|
|
3731
3704
|
const position = layer.coordinateToVector3(this._coordinate, z);
|
|
3732
|
-
(0,
|
|
3705
|
+
(0, import_lodash5.set)(this.properties, "default.position", position);
|
|
3733
3706
|
this.getObject3d().position.copy(position);
|
|
3734
3707
|
}
|
|
3735
3708
|
_animation() {
|
|
@@ -4111,6 +4084,7 @@ var INITIAL_ZOOM = 18.5;
|
|
|
4111
4084
|
var CLICK_TOLERANCE = 20;
|
|
4112
4085
|
var defaultOptions = {
|
|
4113
4086
|
pixelRatio: 1,
|
|
4087
|
+
interactions: true,
|
|
4114
4088
|
locale: DEFAULT_LOCALE
|
|
4115
4089
|
};
|
|
4116
4090
|
var IndoorMap = class extends EventTarget {
|
|
@@ -4166,7 +4140,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4166
4140
|
};
|
|
4167
4141
|
constructor(elementId, options) {
|
|
4168
4142
|
super();
|
|
4169
|
-
const combinedOptions =
|
|
4143
|
+
const combinedOptions = import_lodash6.default.merge({}, defaultOptions, options);
|
|
4170
4144
|
this.options = options;
|
|
4171
4145
|
const {
|
|
4172
4146
|
onMapReady,
|
|
@@ -4182,6 +4156,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4182
4156
|
zoom: INITIAL_ZOOM,
|
|
4183
4157
|
clickTimeThreshold: 600,
|
|
4184
4158
|
centerCross: options.centerCross ?? false,
|
|
4159
|
+
...options.interactions === false ? {
|
|
4160
|
+
draggable: false,
|
|
4161
|
+
dragPan: false,
|
|
4162
|
+
dragRotate: false,
|
|
4163
|
+
dragPitch: false,
|
|
4164
|
+
scrollWheelZoom: false,
|
|
4165
|
+
touchZoom: false,
|
|
4166
|
+
doubleClickZoom: false
|
|
4167
|
+
} : {},
|
|
4185
4168
|
baseLayer: new import_maptalks_gl.TileLayer("base", {
|
|
4186
4169
|
urlTemplate: "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
|
|
4187
4170
|
subdomains: ["a", "b", "c", "d"],
|
|
@@ -4231,7 +4214,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4231
4214
|
handleMapClick = ({ coordinate }) => {
|
|
4232
4215
|
const { x, y } = coordinate;
|
|
4233
4216
|
console.log(
|
|
4234
|
-
`[Coordinates]: x: ${
|
|
4217
|
+
`[Coordinates]: x: ${import_lodash6.default.round(x, 8)} y: ${import_lodash6.default.round(
|
|
4235
4218
|
y,
|
|
4236
4219
|
8
|
|
4237
4220
|
)}, [Bearing]: ${this.map.getBearing()}, [Pitch]: ${this.map.getPitch()}`
|
|
@@ -4312,7 +4295,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4312
4295
|
const scene = this.threeLayer.getScene();
|
|
4313
4296
|
if (scene) {
|
|
4314
4297
|
scene.children = scene.children.filter(
|
|
4315
|
-
(children) => children instanceof
|
|
4298
|
+
(children) => children instanceof import_three6.PerspectiveCamera
|
|
4316
4299
|
);
|
|
4317
4300
|
}
|
|
4318
4301
|
}
|
|
@@ -4320,7 +4303,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4320
4303
|
if (this.#isClicked) return;
|
|
4321
4304
|
this.#isClicked = true;
|
|
4322
4305
|
const onClickElement = this.#onClickElement;
|
|
4323
|
-
if (!
|
|
4306
|
+
if (!import_lodash6.default.isFunction(onClickElement)) return;
|
|
4324
4307
|
this.#onClickElement(e);
|
|
4325
4308
|
this.#isClicked = false;
|
|
4326
4309
|
};
|
|
@@ -4348,16 +4331,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
4348
4331
|
for (const feature2 of this.#features) {
|
|
4349
4332
|
try {
|
|
4350
4333
|
const { feature_type: featureType, properties, id } = feature2;
|
|
4351
|
-
const layerName =
|
|
4334
|
+
const layerName = import_lodash6.default.get(
|
|
4352
4335
|
LAYER_FEATURE_TYPE_OBJ,
|
|
4353
4336
|
featureType,
|
|
4354
4337
|
featureType
|
|
4355
4338
|
);
|
|
4356
4339
|
const layer = this.map.getLayer(layerName);
|
|
4357
4340
|
let geometry;
|
|
4358
|
-
const category =
|
|
4359
|
-
const extrudeConfig =
|
|
4360
|
-
const textMarkerType =
|
|
4341
|
+
const category = import_lodash6.default.get(feature2, "properties.category");
|
|
4342
|
+
const extrudeConfig = import_lodash6.default.get(this.#mapConfig, "extrude");
|
|
4343
|
+
const textMarkerType = import_lodash6.default.get(
|
|
4361
4344
|
this.#mapConfig,
|
|
4362
4345
|
"text_marker_type",
|
|
4363
4346
|
"ui-marker"
|
|
@@ -4510,186 +4493,6 @@ var IndoorMap = class extends EventTarget {
|
|
|
4510
4493
|
clearAnimations() {
|
|
4511
4494
|
this.#animationsToRun = [];
|
|
4512
4495
|
}
|
|
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
4496
|
/**
|
|
4694
4497
|
* User Location
|
|
4695
4498
|
****************************/
|
|
@@ -4714,15 +4517,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4714
4517
|
}
|
|
4715
4518
|
}
|
|
4716
4519
|
updateUserLocationSymbolByLocale(locale) {
|
|
4717
|
-
const userLocationGeometry =
|
|
4520
|
+
const userLocationGeometry = import_lodash6.default.get(
|
|
4718
4521
|
this.#elements,
|
|
4719
4522
|
`${USER_LOCATION_ELEMENT_ID}.geometry`
|
|
4720
4523
|
);
|
|
4721
4524
|
if (!userLocationGeometry) return;
|
|
4722
4525
|
const currentSymbol = userLocationGeometry.getSymbol();
|
|
4723
4526
|
const localeSymbolToUpdate = currentSymbol.map((symbol) => {
|
|
4724
|
-
const localeSymbol =
|
|
4725
|
-
if (!
|
|
4527
|
+
const localeSymbol = import_lodash6.default.get(symbol, `${LOCALE_SYMBOL_KEY}.${locale}`) || import_lodash6.default.get(symbol, `${LOCALE_SYMBOL_KEY}.default`);
|
|
4528
|
+
if (!import_lodash6.default.isPlainObject(localeSymbol)) return symbol;
|
|
4726
4529
|
return {
|
|
4727
4530
|
...symbol,
|
|
4728
4531
|
...localeSymbol
|
|
@@ -4796,14 +4599,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
4796
4599
|
* END of User Location
|
|
4797
4600
|
****************************/
|
|
4798
4601
|
showGeometryByElementId = (elementId) => {
|
|
4799
|
-
const geometry =
|
|
4602
|
+
const geometry = import_lodash6.default.get(
|
|
4800
4603
|
this.#elements,
|
|
4801
4604
|
`${elementId}.geometry`
|
|
4802
4605
|
);
|
|
4803
4606
|
if (geometry) geometry.show();
|
|
4804
4607
|
};
|
|
4805
4608
|
hideGeometryByElementId = (elementId) => {
|
|
4806
|
-
const geometry =
|
|
4609
|
+
const geometry = import_lodash6.default.get(this.#elements, `${elementId}.geometry`);
|
|
4807
4610
|
if (geometry) geometry.hide();
|
|
4808
4611
|
};
|
|
4809
4612
|
setSpriteMarkersOpacity = (opacity = 1) => {
|
|
@@ -4850,13 +4653,13 @@ var IndoorMap = class extends EventTarget {
|
|
|
4850
4653
|
const line = lineStrings[i];
|
|
4851
4654
|
const coords = line.geometry.coordinates;
|
|
4852
4655
|
const prevLine = lineStrings[i - 1];
|
|
4853
|
-
const firstCoord =
|
|
4656
|
+
const firstCoord = import_lodash6.default.first(coords);
|
|
4854
4657
|
const isFirstLine = i === 0;
|
|
4855
4658
|
if (isFirstLine) {
|
|
4856
4659
|
accLine.push(...coords);
|
|
4857
4660
|
continue;
|
|
4858
4661
|
}
|
|
4859
|
-
const prevLastCoord =
|
|
4662
|
+
const prevLastCoord = import_lodash6.default.last(prevLine.geometry.coordinates);
|
|
4860
4663
|
const isNearby = (0, import_distance.default)(point(firstCoord), point(prevLastCoord)) < distance;
|
|
4861
4664
|
if (!isNearby) {
|
|
4862
4665
|
const remainingLines = lineStrings.slice(i);
|
|
@@ -4877,8 +4680,8 @@ var IndoorMap = class extends EventTarget {
|
|
|
4877
4680
|
create3DStepPath
|
|
4878
4681
|
} = this.#styler;
|
|
4879
4682
|
const routeMarkerLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
|
|
4880
|
-
const linesByOrdinal = (0,
|
|
4881
|
-
const joinedLines = (0,
|
|
4683
|
+
const linesByOrdinal = (0, import_lodash6.default)(stepGeometries).filter(({ geometry }) => geometry.type === "LineString").groupBy("properties.ordinal").value();
|
|
4684
|
+
const joinedLines = (0, import_lodash6.default)(linesByOrdinal).reduce((acc, lines, key) => {
|
|
4882
4685
|
const joined = this.combineNearbyLineStrings(lines, {
|
|
4883
4686
|
properties: { ordinal: +key }
|
|
4884
4687
|
});
|
|
@@ -4906,14 +4709,14 @@ var IndoorMap = class extends EventTarget {
|
|
|
4906
4709
|
stepElement = createOriginMarker(stepGeometry).addTo(routeMarkerLayer);
|
|
4907
4710
|
break;
|
|
4908
4711
|
case "destination-marker":
|
|
4909
|
-
const extrudeConfig =
|
|
4712
|
+
const extrudeConfig = import_lodash6.default.get(this.#mapConfig, "extrude");
|
|
4910
4713
|
if (destinationFeature.feature_type === "occupant") {
|
|
4911
|
-
const stepId =
|
|
4714
|
+
const stepId = import_lodash6.default.get(stepGeometry, "id");
|
|
4912
4715
|
const normalizedDestinationFeature = {
|
|
4913
4716
|
...destinationFeature,
|
|
4914
4717
|
id: stepId
|
|
4915
4718
|
};
|
|
4916
|
-
const logoUrl =
|
|
4719
|
+
const logoUrl = import_lodash6.default.get(
|
|
4917
4720
|
normalizedDestinationFeature,
|
|
4918
4721
|
"properties.logo.url"
|
|
4919
4722
|
);
|
|
@@ -4958,15 +4761,15 @@ var IndoorMap = class extends EventTarget {
|
|
|
4958
4761
|
const routeMarkerLayer = this.map.getLayer(
|
|
4959
4762
|
HIGHLIGHT_LAYER_NAME
|
|
4960
4763
|
);
|
|
4961
|
-
const originMarkerGeometry =
|
|
4764
|
+
const originMarkerGeometry = import_lodash6.default.get(
|
|
4962
4765
|
this.#elements,
|
|
4963
4766
|
`${ORIGIN_MARKER_ID}.geometry`
|
|
4964
4767
|
);
|
|
4965
|
-
const destinationMarkerGeometry =
|
|
4768
|
+
const destinationMarkerGeometry = import_lodash6.default.get(
|
|
4966
4769
|
this.#elements,
|
|
4967
4770
|
`${DESTINATION_MARKER_ID}.geometry`
|
|
4968
4771
|
);
|
|
4969
|
-
const geometriesToRemove =
|
|
4772
|
+
const geometriesToRemove = import_lodash6.default.compact([
|
|
4970
4773
|
originMarkerGeometry,
|
|
4971
4774
|
destinationMarkerGeometry
|
|
4972
4775
|
]);
|
|
@@ -4977,7 +4780,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
4977
4780
|
(obj) => !(obj instanceof NavigationPath)
|
|
4978
4781
|
);
|
|
4979
4782
|
const objects = this.#navigationGeometries || {};
|
|
4980
|
-
|
|
4783
|
+
import_lodash6.default.forEach(objects, (obj) => {
|
|
4981
4784
|
if (!obj) return;
|
|
4982
4785
|
this.#navigationGeometries[obj.properties.id] = null;
|
|
4983
4786
|
obj.remove();
|
|
@@ -5014,7 +4817,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5014
4817
|
}
|
|
5015
4818
|
if (this.threeLayer) {
|
|
5016
4819
|
const currentView = this.camera.getView();
|
|
5017
|
-
const objectOpacity =
|
|
4820
|
+
const objectOpacity = import_lodash6.default.clamp(38 - 2 * currentView.zoom, 0, 1);
|
|
5018
4821
|
this.#objects.forEach((object) => {
|
|
5019
4822
|
object.getObject3d().traverse((child) => {
|
|
5020
4823
|
if (child.isMesh) child.material.opacity = objectOpacity;
|
|
@@ -5024,7 +4827,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5024
4827
|
});
|
|
5025
4828
|
if (this.#billboardObjects) {
|
|
5026
4829
|
this.#billboardObjects.forEach((object) => {
|
|
5027
|
-
const objectScale =
|
|
4830
|
+
const objectScale = import_lodash6.default.clamp(
|
|
5028
4831
|
20 - 1 * currentView.zoom,
|
|
5029
4832
|
1,
|
|
5030
4833
|
1.05
|
|
@@ -5033,7 +4836,7 @@ var IndoorMap = class extends EventTarget {
|
|
|
5033
4836
|
});
|
|
5034
4837
|
}
|
|
5035
4838
|
if (this.#isLayersFadingOnZoom) {
|
|
5036
|
-
const layerOpacity =
|
|
4839
|
+
const layerOpacity = import_lodash6.default.clamp(1 - objectOpacity, 0, 1);
|
|
5037
4840
|
LAYERS.forEach((layerKey) => {
|
|
5038
4841
|
const layer = this.map.getLayer(layerKey);
|
|
5039
4842
|
if (layer) layer.setOpacity(layerOpacity);
|
|
@@ -5052,19 +4855,16 @@ var IndoorMap = class extends EventTarget {
|
|
|
5052
4855
|
});
|
|
5053
4856
|
}
|
|
5054
4857
|
this.#animationsToRun.forEach(({ callback }) => callback(this));
|
|
5055
|
-
|
|
4858
|
+
import_tween.default.update();
|
|
5056
4859
|
requestAnimationFrame(this.render.bind(this));
|
|
5057
4860
|
}
|
|
5058
4861
|
};
|
|
5059
4862
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5060
4863
|
0 && (module.exports = {
|
|
5061
4864
|
ALL_FEATURE_TYPES,
|
|
5062
|
-
ALWAYS_VISIBLE_FEATURE_TYPES,
|
|
5063
4865
|
BASE_LAYER_NAME,
|
|
5064
4866
|
DEFAULT_BASE_URL,
|
|
5065
|
-
DEFAULT_HIGHLIGHT_OPTIONS,
|
|
5066
4867
|
DEFAULT_LOCALE,
|
|
5067
|
-
DEFAULT_SET_HIGHLIGHT_2DELEMENT_IDS_OPTIONS,
|
|
5068
4868
|
DESTINATION_MARKER_ID,
|
|
5069
4869
|
GEOJSON_FEATURE_TYPES,
|
|
5070
4870
|
HIGHLIGHT_LAYER_NAME,
|