@panoramax/web-viewer 5.0.0-develop-d26305dd → 5.0.0-develop-be5ba1a7
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/build/cjs/index.js +1 -1
- package/build/cjs/index_photoviewer.js +1 -1
- package/build/esm/components/core/Basic.js +1 -1
- package/build/esm/translations/el.json +92 -1
- package/package.json +1 -1
- package/build/bundle.cjs +0 -3399
- package/build/bundle.cjs.map +0 -1
- package/build/bundle_photoviewer.cjs +0 -2510
- package/build/bundle_photoviewer.cjs.map +0 -1
- package/build/components/core/Basic.css +0 -56
- package/build/components/core/Basic.js +0 -378
- package/build/components/core/CoverageMap.css +0 -10
- package/build/components/core/CoverageMap.js +0 -169
- package/build/components/core/Editor.css +0 -33
- package/build/components/core/Editor.js +0 -398
- package/build/components/core/PhotoViewer.css +0 -70
- package/build/components/core/PhotoViewer.js +0 -650
- package/build/components/core/Viewer.css +0 -130
- package/build/components/core/Viewer.js +0 -711
- package/build/components/core/index.js +0 -10
- package/build/components/index.js +0 -11
- package/build/components/index_photoviewer.js +0 -6
- package/build/components/layout/BottomDrawer.js +0 -258
- package/build/components/layout/CorneredGrid.js +0 -143
- package/build/components/layout/Mini.js +0 -121
- package/build/components/layout/Tabs.js +0 -140
- package/build/components/layout/index.js +0 -9
- package/build/components/menus/LocationPrecisionDoc.js +0 -42
- package/build/components/menus/MapBackground.js +0 -110
- package/build/components/menus/MapFilters.js +0 -567
- package/build/components/menus/MapLayers.js +0 -238
- package/build/components/menus/MapLegend.js +0 -68
- package/build/components/menus/MiniPictureLegend.js +0 -73
- package/build/components/menus/PictureLegend.js +0 -379
- package/build/components/menus/PictureMetadata.js +0 -380
- package/build/components/menus/PlayerOptions.js +0 -93
- package/build/components/menus/QualityScoreDoc.js +0 -42
- package/build/components/menus/ReportForm.js +0 -132
- package/build/components/menus/SemanticsDoc.js +0 -38
- package/build/components/menus/SemanticsDownload.js +0 -33
- package/build/components/menus/SemanticsFilters.js +0 -153
- package/build/components/menus/SemanticsList.js +0 -413
- package/build/components/menus/SemanticsMetadata.js +0 -368
- package/build/components/menus/Share.js +0 -105
- package/build/components/menus/index.js +0 -22
- package/build/components/menus/index_photoviewer.js +0 -11
- package/build/components/styles.js +0 -557
- package/build/components/ui/AnnotationsSwitch.js +0 -159
- package/build/components/ui/Button.js +0 -77
- package/build/components/ui/ButtonGroup.css +0 -59
- package/build/components/ui/ButtonGroup.js +0 -69
- package/build/components/ui/CopyButton.js +0 -110
- package/build/components/ui/Grade.js +0 -54
- package/build/components/ui/GradeFilter.js +0 -122
- package/build/components/ui/IconSwitch.js +0 -193
- package/build/components/ui/LinkButton.js +0 -67
- package/build/components/ui/ListGroup.js +0 -66
- package/build/components/ui/ListItem.js +0 -90
- package/build/components/ui/Loader.js +0 -203
- package/build/components/ui/Map.css +0 -63
- package/build/components/ui/Map.js +0 -853
- package/build/components/ui/MapMore.js +0 -175
- package/build/components/ui/Photo.css +0 -50
- package/build/components/ui/Photo.js +0 -1502
- package/build/components/ui/Popup.js +0 -145
- package/build/components/ui/ProgressBar.js +0 -104
- package/build/components/ui/QualityScore.js +0 -147
- package/build/components/ui/SearchBar.js +0 -374
- package/build/components/ui/SemanticsEditor.js +0 -191
- package/build/components/ui/SemanticsTable.js +0 -88
- package/build/components/ui/Switch.js +0 -139
- package/build/components/ui/TogglableGroup.js +0 -157
- package/build/components/ui/index.js +0 -29
- package/build/components/ui/index_photoviewer.js +0 -21
- package/build/components/ui/widgets/CopyCoordinates.js +0 -75
- package/build/components/ui/widgets/GeoSearch.css +0 -21
- package/build/components/ui/widgets/GeoSearch.js +0 -150
- package/build/components/ui/widgets/Legend.js +0 -190
- package/build/components/ui/widgets/LevelSelect.css +0 -51
- package/build/components/ui/widgets/LevelSelect.js +0 -143
- package/build/components/ui/widgets/MapFiltersButton.js +0 -114
- package/build/components/ui/widgets/MapLayersButton.js +0 -79
- package/build/components/ui/widgets/OSMEditors.js +0 -155
- package/build/components/ui/widgets/PictureLegendActions.js +0 -99
- package/build/components/ui/widgets/Player.css +0 -7
- package/build/components/ui/widgets/Player.js +0 -154
- package/build/components/ui/widgets/SemanticsFiltersButton.js +0 -65
- package/build/components/ui/widgets/Zoom.js +0 -84
- package/build/components/ui/widgets/index.js +0 -16
- package/build/components/ui/widgets/index_photoviewer.js +0 -7
- package/build/img/arrow_360.svg +0 -14
- package/build/img/arrow_flat.svg +0 -11
- package/build/img/arrow_triangle.svg +0 -9
- package/build/img/arrow_turn.svg +0 -8
- package/build/img/bg_aerial.jpg +0 -0
- package/build/img/bg_streets.jpg +0 -0
- package/build/img/loader_base.jpg +0 -0
- package/build/img/logo_dead.svg +0 -91
- package/build/img/marker.svg +0 -17
- package/build/img/marker_blue.svg +0 -20
- package/build/img/osm.svg +0 -49
- package/build/img/panoramax.svg +0 -13
- package/build/img/switch_big.svg +0 -54
- package/build/img/switch_mini.svg +0 -48
- package/build/img/wd.svg +0 -1
- package/build/index_photoviewer.js +0 -4
- package/build/package.json +0 -148
- package/build/servers.js +0 -14
- package/build/translations/ar.json +0 -1
- package/build/translations/be.json +0 -257
- package/build/translations/br.json +0 -81
- package/build/translations/cy.json +0 -117
- package/build/translations/da.json +0 -300
- package/build/translations/de.json +0 -309
- package/build/translations/en.json +0 -294
- package/build/translations/eo.json +0 -235
- package/build/translations/es.json +0 -292
- package/build/translations/fi.json +0 -1
- package/build/translations/fr.json +0 -294
- package/build/translations/hr.json +0 -294
- package/build/translations/hu.json +0 -294
- package/build/translations/it.json +0 -306
- package/build/translations/ja.json +0 -182
- package/build/translations/ko.json +0 -1
- package/build/translations/nl.json +0 -305
- package/build/translations/nn.json +0 -1
- package/build/translations/pl.json +0 -169
- package/build/translations/pt.json +0 -296
- package/build/translations/pt_BR.json +0 -304
- package/build/translations/sv.json +0 -182
- package/build/translations/ti.json +0 -9
- package/build/translations/tr.json +0 -297
- package/build/translations/uk.json +0 -268
- package/build/translations/zh_Hant.json +0 -309
- package/build/utils/API.js +0 -928
- package/build/utils/InitParameters.js +0 -521
- package/build/utils/MapStyleComposer.js +0 -889
- package/build/utils/PanoraMapProtocol.js +0 -49
- package/build/utils/PhotoAdapter.js +0 -49
- package/build/utils/PresetsManager.js +0 -148
- package/build/utils/SemanticsMapProtocol.js +0 -144
- package/build/utils/URLHandler.js +0 -426
- package/build/utils/geocoder.js +0 -203
- package/build/utils/i18n.js +0 -128
- package/build/utils/index.js +0 -17
- package/build/utils/index_photoviewer.js +0 -14
- package/build/utils/indoor.js +0 -200
- package/build/utils/map.js +0 -788
- package/build/utils/picture.js +0 -507
- package/build/utils/semantics.js +0 -321
- package/build/utils/services.js +0 -148
- package/build/utils/utils.js +0 -433
- package/build/utils/widgets.js +0 -110
package/build/utils/i18n.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import T_be from "../translations/be.json" with { type: "json" };
|
|
2
|
-
import T_da from "../translations/da.json" with { type: "json" };
|
|
3
|
-
import T_de from "../translations/de.json" with { type: "json" };
|
|
4
|
-
import T_en from "../translations/en.json" with { type: "json" };
|
|
5
|
-
import T_eo from "../translations/eo.json" with { type: "json" };
|
|
6
|
-
import T_es from "../translations/es.json" with { type: "json" };
|
|
7
|
-
import T_fr from "../translations/fr.json" with { type: "json" };
|
|
8
|
-
import T_hr from "../translations/hr.json" with { type: "json" };
|
|
9
|
-
import T_hu from "../translations/hu.json" with { type: "json" };
|
|
10
|
-
import T_it from "../translations/it.json" with { type: "json" };
|
|
11
|
-
import T_ja from "../translations/ja.json" with { type: "json" };
|
|
12
|
-
import T_nl from "../translations/nl.json" with { type: "json" };
|
|
13
|
-
import T_pl from "../translations/pl.json" with { type: "json" };
|
|
14
|
-
import T_pt from "../translations/pt.json" with { type: "json" };
|
|
15
|
-
import T_pt_BR from "../translations/pt_BR.json" with { type: "json" };
|
|
16
|
-
import T_sv from "../translations/sv.json" with { type: "json" };
|
|
17
|
-
import T_tr from "../translations/tr.json" with { type: "json" };
|
|
18
|
-
import T_uk from "../translations/uk.json" with { type: "json" };
|
|
19
|
-
import T_zh_Hant from "../translations/zh_Hant.json" with { type: "json" };
|
|
20
|
-
|
|
21
|
-
const FALLBACK_LOCALE = "en";
|
|
22
|
-
const TRANSLATIONS = {
|
|
23
|
-
"be": T_be, "da": T_da, "de": T_de, "eo": T_eo, "en": T_en, "es": T_es, "fr": T_fr,
|
|
24
|
-
"hr": T_hr, "hu": T_hu, "it": T_it, "ja": T_ja, "nl": T_nl, "pl": T_pl, "pt": T_pt, "pt-br": T_pt_BR,
|
|
25
|
-
"sv": T_sv, "tr": T_tr, "uk": T_uk, "zh-hant": T_zh_Hant, "zh": T_zh_Hant,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Find best matching language regarding of list of supported languages and browser accepted languages
|
|
30
|
-
* @param {str[]} supportedTranslations List of supported languages
|
|
31
|
-
* @param {str} fallback The fallback language
|
|
32
|
-
* @returns The best matching language (in lowercase)
|
|
33
|
-
* @private
|
|
34
|
-
*/
|
|
35
|
-
export function autoDetectLocale(supportedTranslations, fallback) {
|
|
36
|
-
supportedTranslations = supportedTranslations.map(k => k.toLowerCase());
|
|
37
|
-
|
|
38
|
-
for (const navigatorLang of window.navigator.languages) {
|
|
39
|
-
let language = navigatorLang.toLowerCase();
|
|
40
|
-
// Convert browser code to weblate code
|
|
41
|
-
switch (language) {
|
|
42
|
-
case "zh-tw":
|
|
43
|
-
case "zh-hk":
|
|
44
|
-
case "zh-mo":
|
|
45
|
-
language = "zh-hant";
|
|
46
|
-
break;
|
|
47
|
-
case "zh-cn":
|
|
48
|
-
case "zh-sg":
|
|
49
|
-
language = "zh-hans";
|
|
50
|
-
break;
|
|
51
|
-
default:
|
|
52
|
-
if (language.length > 2 && !supportedTranslations.includes(language)) {
|
|
53
|
-
language = navigatorLang.substring(0, 2);
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
const pair = supportedTranslations.find((pair) => pair === language);
|
|
58
|
-
if (pair) {
|
|
59
|
-
return pair;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return fallback;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Get text labels translations in given language
|
|
67
|
-
*
|
|
68
|
-
* @param {string} [lang] The language code (fr, en) (defaults to browser preferences)
|
|
69
|
-
* @returns {object} Translations in given language, with fallback to english
|
|
70
|
-
* @private
|
|
71
|
-
*/
|
|
72
|
-
export function getTranslations(lang = "") {
|
|
73
|
-
const myTr = JSON.parse(JSON.stringify(T_en));
|
|
74
|
-
let preferedTr;
|
|
75
|
-
|
|
76
|
-
// No specific lang set -> use browser lang
|
|
77
|
-
if(!lang) {
|
|
78
|
-
lang = autoDetectLocale(Object.keys(TRANSLATIONS), FALLBACK_LOCALE);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Lang exists -> send it
|
|
82
|
-
if(TRANSLATIONS[lang] && lang !== "en") {
|
|
83
|
-
preferedTr = TRANSLATIONS[lang];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Look for primary lang
|
|
87
|
-
if(lang.length > 2) {
|
|
88
|
-
const primaryLang = lang.substring(0, 2);
|
|
89
|
-
if(TRANSLATIONS[primaryLang]) { preferedTr = TRANSLATIONS[primaryLang]; }
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Merge labels to avoid missing ones
|
|
93
|
-
if(preferedTr) {
|
|
94
|
-
Object.entries(preferedTr).forEach(([k1, k2]) => {
|
|
95
|
-
Object.entries(k2).forEach(([k2, k3]) => {
|
|
96
|
-
// eslint-disable-next-line eqeqeq
|
|
97
|
-
if(Array.isArray(k3)) { k3 = k3.filter(v => v != null); }
|
|
98
|
-
myTr[k1][k2] = k3;
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
myTr.PREF_LANG = lang;
|
|
104
|
-
|
|
105
|
-
return myTr;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Get best matching label based on user language
|
|
111
|
-
* @param {object} labels The key->value list of labels
|
|
112
|
-
* @param {string} [lang] The language code (fr, en) (defaults to browser preferences)
|
|
113
|
-
* @returns {string} The best matching label
|
|
114
|
-
*/
|
|
115
|
-
export function getBestLabel(labels, lang) {
|
|
116
|
-
// All to lowercase to avoid matching issues
|
|
117
|
-
lang = lang ? lang.toLowerCase() : null;
|
|
118
|
-
labels = Object.fromEntries(Object.entries(labels).map(([k,v]) => [k.toLowerCase(), v]));
|
|
119
|
-
|
|
120
|
-
// No specific lang set -> use browser lang
|
|
121
|
-
if(!lang) {
|
|
122
|
-
lang = autoDetectLocale(Object.keys(labels), FALLBACK_LOCALE);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if(labels[lang]) { return labels[lang]; }
|
|
126
|
-
else if(lang.length > 2 && labels[lang.substring(0,2)]) { return labels[lang.substring(0,2)]; }
|
|
127
|
-
else { return labels[FALLBACK_LOCALE] || ""; }
|
|
128
|
-
}
|
package/build/utils/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as geocoder from "./geocoder.js";
|
|
2
|
-
import * as i18n from "./i18n.js";
|
|
3
|
-
import * as indoor from "./indoor.js";
|
|
4
|
-
import * as map from "./map.js";
|
|
5
|
-
import * as picture from "./picture.js";
|
|
6
|
-
import * as semantics from "./semantics.js";
|
|
7
|
-
import * as services from "./services.js";
|
|
8
|
-
import * as utils from "./utils.js";
|
|
9
|
-
import * as widgets from "./widgets.js";
|
|
10
|
-
|
|
11
|
-
export { geocoder, i18n, indoor, map, picture, semantics, services, utils, widgets };
|
|
12
|
-
export {default as API} from "./API.js";
|
|
13
|
-
export {default as InitParameters} from "./InitParameters.js";
|
|
14
|
-
export {default as MapStyleComposer} from "./MapStyleComposer.js";
|
|
15
|
-
export {default as PhotoAdapter} from "./PhotoAdapter.js";
|
|
16
|
-
export {default as PresetsManager} from "./PresetsManager.js";
|
|
17
|
-
export {default as URLHandler} from "./URLHandler.js";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Lightweight export for PhotoViewer
|
|
2
|
-
import * as i18n from "./i18n.js";
|
|
3
|
-
import * as picture from "./picture.js";
|
|
4
|
-
import * as semantics from "./semantics.js";
|
|
5
|
-
import * as services from "./services.js";
|
|
6
|
-
import * as utils from "./utils.js";
|
|
7
|
-
import * as widgets from "./widgets.js";
|
|
8
|
-
|
|
9
|
-
export { i18n, picture, semantics, services, utils, widgets };
|
|
10
|
-
export {default as API} from "./API.js";
|
|
11
|
-
export {default as InitParameters} from "./InitParameters.js";
|
|
12
|
-
export {default as PhotoAdapter} from "./PhotoAdapter.js";
|
|
13
|
-
export {default as PresetsManager} from "./PresetsManager.js";
|
|
14
|
-
export {default as URLHandler} from "./URLHandler.js";
|
package/build/utils/indoor.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { IndoorEqualSpritesURL } from "./services.js";
|
|
2
|
-
import { createWebComp } from "./widgets.js";
|
|
3
|
-
|
|
4
|
-
export const DISABLED_LEVEL = "-1000";
|
|
5
|
-
const LEVEL_SEM_LAYER = "levels";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export function isIndoorEqualAvailable() {
|
|
9
|
-
try {
|
|
10
|
-
// eslint-disable-next-line no-undef
|
|
11
|
-
IndoorEqual;
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
catch(e) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Enables indoor= plugin on MapLibre
|
|
21
|
-
* @param {Map} map The MapLibre map
|
|
22
|
-
* @param {boolean} [forceSwitchOn=false] Set to true to skip init options check for default visibility
|
|
23
|
-
*/
|
|
24
|
-
export function initIndoorEqualOnMap(map, forceSwitchOn = false) {
|
|
25
|
-
if(map._options.indoor) {
|
|
26
|
-
if(isIndoorEqualAvailable()) {
|
|
27
|
-
if(!forceSwitchOn && map._options.indoor.visible === false) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line no-undef
|
|
32
|
-
map.indoorEqual = new IndoorEqual(map, map._options.indoor);
|
|
33
|
-
map.addControl(map.indoorEqual);
|
|
34
|
-
map.indoorEqual.loadSprite(IndoorEqualSpritesURL());
|
|
35
|
-
|
|
36
|
-
// Override level refresh to keep "disabled" state after map move
|
|
37
|
-
map.indoorEqual._refreshAfterLevelsUpdate = function() {
|
|
38
|
-
// eslint-disable-next-line eqeqeq
|
|
39
|
-
if (!this.levels.includes(this.level) && this.level != DISABLED_LEVEL) {
|
|
40
|
-
this.setLevel("0");
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// Override updateLevels to take into account pictures levels
|
|
45
|
-
const SEM_SRC_ID = "sem-"+LEVEL_SEM_LAYER;
|
|
46
|
-
map.indoorEqual._updateLevels = function() {
|
|
47
|
-
if(
|
|
48
|
-
this.map.getSource(this.source.sourceId)
|
|
49
|
-
&& this.map.isSourceLoaded(this.source.sourceId)
|
|
50
|
-
&& this.map.getSource(SEM_SRC_ID)
|
|
51
|
-
&& this.map.isSourceLoaded(SEM_SRC_ID)
|
|
52
|
-
) {
|
|
53
|
-
let levels = new Set();
|
|
54
|
-
|
|
55
|
-
// Read levels from indoor= tiles
|
|
56
|
-
this.map.querySourceFeatures(this.source.sourceId, { sourceLayer: "area" })
|
|
57
|
-
.forEach(f => {
|
|
58
|
-
if(f.properties.class === "level") { return; }
|
|
59
|
-
if(f.properties.level !== undefined) {
|
|
60
|
-
levels.add(f.properties.level.toString());
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Read levels from Panoramax tiles
|
|
65
|
-
this.map.querySourceFeatures(SEM_SRC_ID, { sourceLayer: "layer" })
|
|
66
|
-
.forEach(f => {
|
|
67
|
-
if(f.properties["osm|level"] !== undefined) {
|
|
68
|
-
levels.add(f.properties["osm|level"].toString());
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// If at least one level exist, add floor just to be sure it's always present
|
|
73
|
-
if(levels.size > 0) { levels.add("0"); }
|
|
74
|
-
|
|
75
|
-
if(levels.symmetricDifference(new Set(this.levels)).size !== 0) {
|
|
76
|
-
this.levels = [...levels].sort((a, b) => parseFloat(a) - parseFloat(b)).reverse();
|
|
77
|
-
this._emitLevelsChange();
|
|
78
|
-
this._refreshAfterLevelsUpdate();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// Store features IDs by level
|
|
84
|
-
map._indoorFeaturesIDs = { pictures: {}, sequences: {} };
|
|
85
|
-
map.on("sourcedata", LEVEL_SEM_LAYER, e => {
|
|
86
|
-
if(e.sourceId === SEM_SRC_ID) {
|
|
87
|
-
e.features.forEach(f => {
|
|
88
|
-
if(!map._indoorFeaturesIDs.pictures[f.properties["osm|level"]]) {
|
|
89
|
-
map._indoorFeaturesIDs.pictures[f.properties["osm|level"]] = new Set();
|
|
90
|
-
}
|
|
91
|
-
if(!map._indoorFeaturesIDs.sequences[f.properties["osm|level"]]) {
|
|
92
|
-
map._indoorFeaturesIDs.sequences[f.properties["osm|level"]] = new Set();
|
|
93
|
-
}
|
|
94
|
-
map._indoorFeaturesIDs.pictures[f.properties["osm|level"]].add(f.properties.picid);
|
|
95
|
-
map._indoorFeaturesIDs.sequences[f.properties["osm|level"]].add(f.properties.seqid);
|
|
96
|
-
});
|
|
97
|
-
updateIndoorLevelFilteringThrottled();
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
// Create semantic overlay layer for loading with-level pictures
|
|
102
|
-
const postMapLoad = () => {
|
|
103
|
-
map.addSemanticOverlay?.(
|
|
104
|
-
LEVEL_SEM_LAYER,
|
|
105
|
-
"\"semantics.osm|level\" IS NOT NULL",
|
|
106
|
-
{
|
|
107
|
-
type: "circle",
|
|
108
|
-
layout: { visibility: "visible" },
|
|
109
|
-
paint: { "circle-opacity": 0 }
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
// Load level from component/URL if any
|
|
114
|
-
if(forceSwitchOn && map._parent._initParams?.getMapPostInit()?.level === DISABLED_LEVEL) {
|
|
115
|
-
map.indoorEqual.setLevel("0");
|
|
116
|
-
}
|
|
117
|
-
else if(![null, undefined, ""].includes(map._parent._initParams?.getMapPostInit()?.level)) {
|
|
118
|
-
map.indoorEqual.setLevel(map._parent._initParams?.getMapPostInit()?.level);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
// Wait for map load, done with loop due to an issue with styleload event not sent properly
|
|
122
|
-
if(map.isStyleLoaded()) { postMapLoad(); }
|
|
123
|
-
else {
|
|
124
|
-
const waitForStyle = setInterval(() => {
|
|
125
|
-
if(map.isStyleLoaded()) {
|
|
126
|
-
postMapLoad();
|
|
127
|
-
clearInterval(waitForStyle);
|
|
128
|
-
}
|
|
129
|
-
}, 250);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Add map widget for level select
|
|
133
|
-
map._parent.grid.appendChild(createWebComp("pnx-level-select", {
|
|
134
|
-
slot: "bottom-right",
|
|
135
|
-
_parent: map._parent,
|
|
136
|
-
class: "pnx-only-map pnx-print-hidden",
|
|
137
|
-
}));
|
|
138
|
-
|
|
139
|
-
// Filter indoor pictures based on selected level
|
|
140
|
-
let updateIndoorLevelFilteringThrottler;
|
|
141
|
-
const updateIndoorLevelFiltering = () => {
|
|
142
|
-
// Disabled = show everything
|
|
143
|
-
if(map.indoorEqual.level === DISABLED_LEVEL) {
|
|
144
|
-
map.restrictVisibleFeatures("hide", "pictures", []);
|
|
145
|
-
map.restrictVisibleFeatures("hide", "sequences", []);
|
|
146
|
-
}
|
|
147
|
-
// Ground level = hide all other levels features
|
|
148
|
-
else if(map.indoorEqual.level === "0") {
|
|
149
|
-
// Pictures
|
|
150
|
-
const nonGroundPics = new Set();
|
|
151
|
-
Object.entries(map._indoorFeaturesIDs.pictures).forEach(([lvl, features]) => {
|
|
152
|
-
// eslint-disable-next-line eqeqeq
|
|
153
|
-
if(lvl != "0") { features.forEach(f => nonGroundPics.add(f)); }
|
|
154
|
-
});
|
|
155
|
-
map.restrictVisibleFeatures("hide", "pictures", [...nonGroundPics]);
|
|
156
|
-
|
|
157
|
-
// Sequences
|
|
158
|
-
let nonGroundSeqs = new Set();
|
|
159
|
-
Object.entries(map._indoorFeaturesIDs.sequences).forEach(([lvl, features]) => {
|
|
160
|
-
// eslint-disable-next-line eqeqeq
|
|
161
|
-
if(lvl != "0") {
|
|
162
|
-
nonGroundSeqs = nonGroundSeqs.union(features);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
if(map._indoorFeaturesIDs.sequences["0"]) { nonGroundSeqs = nonGroundSeqs.difference(map._indoorFeaturesIDs.sequences["0"]); } // To skip multi-level sequences
|
|
166
|
-
map.restrictVisibleFeatures("hide", "sequences", [...nonGroundSeqs]);
|
|
167
|
-
}
|
|
168
|
-
// Other level = show only appropriate level features
|
|
169
|
-
else {
|
|
170
|
-
map.restrictVisibleFeatures(
|
|
171
|
-
"keep",
|
|
172
|
-
"pictures",
|
|
173
|
-
map._indoorFeaturesIDs.pictures[map.indoorEqual.level]
|
|
174
|
-
? [...map._indoorFeaturesIDs.pictures[map.indoorEqual.level]]
|
|
175
|
-
: []
|
|
176
|
-
);
|
|
177
|
-
map.restrictVisibleFeatures(
|
|
178
|
-
"keep",
|
|
179
|
-
"sequences",
|
|
180
|
-
map._indoorFeaturesIDs.sequences[map.indoorEqual.level]
|
|
181
|
-
? [...map._indoorFeaturesIDs.sequences[map.indoorEqual.level]]
|
|
182
|
-
: []
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
const updateIndoorLevelFilteringThrottled = () => {
|
|
187
|
-
if(updateIndoorLevelFilteringThrottler) {
|
|
188
|
-
clearTimeout(updateIndoorLevelFilteringThrottler);
|
|
189
|
-
updateIndoorLevelFilteringThrottler = undefined;
|
|
190
|
-
}
|
|
191
|
-
updateIndoorLevelFilteringThrottler = setTimeout(updateIndoorLevelFiltering, 250);
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
map.indoorEqual.on("levelchange", updateIndoorLevelFilteringThrottled);
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
console.error("The indoor= plugin is not enabled. Please add the maplibre-gl-indoorequal before calling 'indoor' option of Panoramax Viewer.");
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|