@panoramax/web-viewer 4.4.0-develop-3839b5a4 → 4.4.0-develop-f91f6758
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/{src → build}/components/core/Basic.js +22 -16
- package/{src → build}/components/core/CoverageMap.js +19 -14
- package/{src → build}/components/core/Editor.js +16 -16
- package/{src → build}/components/core/PhotoViewer.js +30 -29
- package/{src → build}/components/core/Viewer.js +21 -20
- package/build/components/core/index.js +10 -0
- package/build/components/index.js +11 -0
- package/build/components/index_photoviewer.js +6 -0
- package/{src → build}/components/layout/BottomDrawer.js +4 -4
- package/{src → build}/components/layout/CorneredGrid.js +1 -1
- package/{src → build}/components/layout/Mini.js +5 -4
- package/{src → build}/components/layout/Tabs.js +1 -1
- package/build/components/layout/index.js +9 -0
- package/{src → build}/components/menus/LocationPrecisionDoc.js +4 -6
- package/{src → build}/components/menus/MapBackground.js +4 -6
- package/{src → build}/components/menus/MapFilters.js +16 -21
- package/{src → build}/components/menus/MapLayers.js +20 -24
- package/{src → build}/components/menus/MapLegend.js +3 -4
- package/{src → build}/components/menus/MiniPictureLegend.js +3 -4
- package/{src → build}/components/menus/PictureLegend.js +10 -15
- package/{src → build}/components/menus/PictureMetadata.js +12 -19
- package/{src → build}/components/menus/PlayerOptions.js +5 -7
- package/{src → build}/components/menus/QualityScoreDoc.js +3 -4
- package/{src → build}/components/menus/ReportForm.js +8 -9
- package/{src → build}/components/menus/SemanticsDoc.js +3 -4
- package/{src → build}/components/menus/SemanticsDownload.js +3 -3
- package/{src → build}/components/menus/SemanticsFilters.js +7 -8
- package/{src → build}/components/menus/SemanticsList.js +11 -18
- package/{src → build}/components/menus/SemanticsMetadata.js +8 -11
- package/{src → build}/components/menus/Share.js +6 -7
- package/build/components/menus/index.js +22 -0
- package/build/components/menus/index_photoviewer.js +11 -0
- package/{src → build}/components/styles.js +0 -2
- package/{src → build}/components/ui/AnnotationsSwitch.js +6 -8
- package/{src → build}/components/ui/Button.js +1 -1
- package/{src → build}/components/ui/ButtonGroup.js +2 -1
- package/{src → build}/components/ui/CopyButton.js +4 -6
- package/{src → build}/components/ui/Grade.js +5 -5
- package/{src → build}/components/ui/GradeFilter.js +3 -3
- package/{src → build}/components/ui/IconSwitch.js +1 -1
- package/{src → build}/components/ui/LinkButton.js +1 -1
- package/{src → build}/components/ui/ListGroup.js +3 -3
- package/{src → build}/components/ui/ListItem.js +1 -1
- package/{src → build}/components/ui/Loader.js +8 -7
- package/{src → build}/components/ui/Map.js +38 -26
- package/{src → build}/components/ui/MapMore.js +7 -7
- package/{src → build}/components/ui/Photo.js +29 -27
- package/{src → build}/components/ui/Popup.js +4 -4
- package/{src → build}/components/ui/QualityScore.js +4 -4
- package/{src → build}/components/ui/SearchBar.js +6 -7
- package/{src → build}/components/ui/SemanticsEditor.js +14 -15
- package/{src → build}/components/ui/SemanticsTable.js +4 -5
- package/{src → build}/components/ui/Switch.js +1 -1
- package/{src → build}/components/ui/TogglableGroup.js +4 -4
- package/build/components/ui/index.js +29 -0
- package/build/components/ui/index_photoviewer.js +21 -0
- package/{src → build}/components/ui/widgets/CopyCoordinates.js +5 -5
- package/{src → build}/components/ui/widgets/GeoSearch.js +10 -10
- package/{src → build}/components/ui/widgets/Legend.js +9 -8
- package/{src → build}/components/ui/widgets/LevelSelect.js +9 -7
- package/{src → build}/components/ui/widgets/MapFiltersButton.js +5 -5
- package/{src → build}/components/ui/widgets/MapLayersButton.js +5 -5
- package/{src → build}/components/ui/widgets/OSMEditors.js +8 -8
- package/{src → build}/components/ui/widgets/PictureLegendActions.js +4 -4
- package/{src → build}/components/ui/widgets/Player.js +6 -7
- package/{src → build}/components/ui/widgets/SemanticsFiltersButton.js +6 -7
- package/{src → build}/components/ui/widgets/Zoom.js +6 -6
- package/build/components/ui/widgets/index.js +16 -0
- package/build/components/ui/widgets/index_photoviewer.js +7 -0
- package/build/editor.html +94 -10
- package/{src → build}/img/arrow_triangle.svg +0 -1
- package/{src → build}/img/arrow_turn.svg +0 -1
- package/build/index.html +111 -1
- package/build/index.js +6 -95
- package/build/index_photoviewer.js +4 -0
- package/build/map.html +97 -1
- package/build/package.json +141 -0
- package/build/photo.html +85 -1
- package/build/servers.js +3 -4
- package/{src → build}/utils/API.js +33 -33
- package/{src → build}/utils/InitParameters.js +11 -9
- package/{src → build}/utils/MapStyleComposer.js +39 -37
- package/{src → build}/utils/PhotoAdapter.js +1 -0
- package/{src → build}/utils/PresetsManager.js +4 -4
- package/{src → build}/utils/SemanticsMapProtocol.js +3 -4
- package/{src → build}/utils/URLHandler.js +16 -14
- package/{src → build}/utils/geocoder.js +5 -5
- package/{src → build}/utils/i18n.js +21 -20
- package/build/utils/index.js +17 -0
- package/build/utils/index_photoviewer.js +14 -0
- package/{src → build}/utils/indoor.js +9 -5
- package/{src → build}/utils/map.js +15 -11
- package/{src → build}/utils/picture.js +22 -17
- package/{src → build}/utils/semantics.js +9 -5
- package/{src → build}/utils/utils.js +8 -4
- package/{src → build}/utils/widgets.js +2 -2
- package/build/viewer.html +120 -35
- package/build/viewer_indoor.html +90 -8
- package/build/widgets.html +410 -1
- package/package.json +81 -204
- package/.dockerignore +0 -7
- package/.gitlab-ci.yml +0 -78
- package/CHANGELOG.md +0 -853
- package/CODE_OF_CONDUCT.md +0 -134
- package/Dockerfile +0 -14
- package/build/index.css +0 -36
- package/build/index.css.map +0 -1
- package/build/index.js.map +0 -1
- package/build/photoviewer.css +0 -36
- package/build/photoviewer.css.map +0 -1
- package/build/photoviewer.js +0 -86
- package/build/photoviewer.js.map +0 -1
- package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff +0 -0
- package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff2 +0 -0
- package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff +0 -0
- package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff2 +0 -0
- package/config/env.js +0 -104
- package/config/getHttpsConfig.js +0 -69
- package/config/getPackageJson.js +0 -25
- package/config/jest/babelTransform.js +0 -29
- package/config/jest/cssTransform.js +0 -14
- package/config/jest/fileTransform.js +0 -40
- package/config/jest/mocks.js +0 -230
- package/config/modules.js +0 -134
- package/config/paths.js +0 -76
- package/config/pnpTs.js +0 -35
- package/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
- package/config/webpack.config.js +0 -825
- package/config/webpackDevServer.config.js +0 -131
- package/docs/03_URL_settings.md +0 -218
- package/docs/05_Compatibility.md +0 -83
- package/docs/09_Develop.md +0 -141
- package/docs/90_Releases.md +0 -27
- package/docs/images/class_diagram.drawio +0 -144
- package/docs/images/class_diagram.jpg +0 -0
- package/docs/images/comparative_3drender.jpg +0 -0
- package/docs/images/indoor_level.png +0 -0
- package/docs/images/screenshot.jpg +0 -0
- package/docs/index.md +0 -159
- package/docs/reference/components/core/Basic.md +0 -211
- package/docs/reference/components/core/CoverageMap.md +0 -220
- package/docs/reference/components/core/Editor.md +0 -252
- package/docs/reference/components/core/PhotoViewer.md +0 -320
- package/docs/reference/components/core/Viewer.md +0 -398
- package/docs/reference/components/layout/BottomDrawer.md +0 -35
- package/docs/reference/components/layout/CorneredGrid.md +0 -29
- package/docs/reference/components/layout/Mini.md +0 -45
- package/docs/reference/components/layout/Tabs.md +0 -46
- package/docs/reference/components/menus/LocationPrecisionDoc.md +0 -15
- package/docs/reference/components/menus/MapBackground.md +0 -32
- package/docs/reference/components/menus/MapFilters.md +0 -37
- package/docs/reference/components/menus/MapLayers.md +0 -15
- package/docs/reference/components/menus/MapLegend.md +0 -32
- package/docs/reference/components/menus/MiniPictureLegend.md +0 -15
- package/docs/reference/components/menus/PictureLegend.md +0 -45
- package/docs/reference/components/menus/PictureMetadata.md +0 -32
- package/docs/reference/components/menus/PlayerOptions.md +0 -15
- package/docs/reference/components/menus/QualityScoreDoc.md +0 -15
- package/docs/reference/components/menus/ReportForm.md +0 -15
- package/docs/reference/components/menus/SemanticsDoc.md +0 -15
- package/docs/reference/components/menus/SemanticsDownload.md +0 -15
- package/docs/reference/components/menus/SemanticsFilters.md +0 -33
- package/docs/reference/components/menus/SemanticsList.md +0 -97
- package/docs/reference/components/menus/SemanticsMetadata.md +0 -15
- package/docs/reference/components/menus/ShareMenu.md +0 -32
- package/docs/reference/components/ui/AnnotationsSwitch.md +0 -32
- package/docs/reference/components/ui/Button.md +0 -40
- package/docs/reference/components/ui/ButtonGroup.md +0 -36
- package/docs/reference/components/ui/CopyButton.md +0 -41
- package/docs/reference/components/ui/Grade.md +0 -32
- package/docs/reference/components/ui/GradeFilter.md +0 -42
- package/docs/reference/components/ui/IconSwitch.md +0 -53
- package/docs/reference/components/ui/LinkButton.md +0 -45
- package/docs/reference/components/ui/ListGroup.md +0 -22
- package/docs/reference/components/ui/ListItem.md +0 -39
- package/docs/reference/components/ui/Loader.md +0 -56
- package/docs/reference/components/ui/Map.md +0 -150
- package/docs/reference/components/ui/MapMore.md +0 -150
- package/docs/reference/components/ui/Photo.md +0 -495
- package/docs/reference/components/ui/Popup.md +0 -56
- package/docs/reference/components/ui/ProgressBar.md +0 -32
- package/docs/reference/components/ui/QualityScore.md +0 -45
- package/docs/reference/components/ui/SearchBar.md +0 -63
- package/docs/reference/components/ui/SemanticsEditor.md +0 -113
- package/docs/reference/components/ui/SemanticsTable.md +0 -32
- package/docs/reference/components/ui/Switch.md +0 -49
- package/docs/reference/components/ui/TogglableGroup.md +0 -39
- package/docs/reference/components/ui/widgets/CopyCoordinates.md +0 -32
- package/docs/reference/components/ui/widgets/GeoSearch.md +0 -36
- package/docs/reference/components/ui/widgets/Legend.md +0 -58
- package/docs/reference/components/ui/widgets/LevelSelect.md +0 -16
- package/docs/reference/components/ui/widgets/MapFiltersButton.md +0 -37
- package/docs/reference/components/ui/widgets/MapLayersButton.md +0 -15
- package/docs/reference/components/ui/widgets/OSMEditors.md +0 -15
- package/docs/reference/components/ui/widgets/PictureLegendActions.md +0 -32
- package/docs/reference/components/ui/widgets/Player.md +0 -34
- package/docs/reference/components/ui/widgets/SemanticsFiltersButton.md +0 -15
- package/docs/reference/components/ui/widgets/Zoom.md +0 -15
- package/docs/reference/utils/API.md +0 -389
- package/docs/reference/utils/InitParameters.md +0 -68
- package/docs/reference/utils/MapStyleComposer.md +0 -408
- package/docs/reference/utils/PanoraMapProtocol.md +0 -28
- package/docs/reference/utils/PresetsManager.md +0 -43
- package/docs/reference/utils/SemanticsMapProtocol.md +0 -43
- package/docs/reference/utils/URLHandler.md +0 -114
- package/docs/reference.md +0 -99
- package/docs/shortcuts.md +0 -11
- package/docs/tutorials/aerial_imagery.md +0 -21
- package/docs/tutorials/authentication.md +0 -10
- package/docs/tutorials/custom_widgets.md +0 -59
- package/docs/tutorials/indoor_maps.md +0 -50
- package/docs/tutorials/map_style.md +0 -83
- package/docs/tutorials/migrate_v4.md +0 -153
- package/docs/tutorials/migrate_v5.md +0 -103
- package/docs/tutorials/semantics_overlays.md +0 -74
- package/docs/tutorials/synced_coverage.md +0 -43
- package/mkdocs.yml +0 -131
- package/public/editor.html +0 -53
- package/public/index.html +0 -70
- package/public/map.html +0 -55
- package/public/photo.html +0 -43
- package/public/servers.js +0 -15
- package/public/viewer.html +0 -79
- package/public/viewer_indoor.html +0 -48
- package/public/widgets.html +0 -366
- package/scripts/build.js +0 -217
- package/scripts/doc.js +0 -79
- package/scripts/start.js +0 -172
- package/scripts/test.js +0 -52
- package/src/components/core/index.js +0 -12
- package/src/components/index.js +0 -13
- package/src/components/index_photoviewer.js +0 -8
- package/src/components/layout/index.js +0 -9
- package/src/components/menus/index.js +0 -22
- package/src/components/menus/index_photoviewer.js +0 -13
- package/src/components/ui/index.js +0 -29
- package/src/components/ui/index_photoviewer.js +0 -23
- package/src/components/ui/widgets/index.js +0 -16
- package/src/components/ui/widgets/index_photoviewer.js +0 -9
- package/src/index.js +0 -8
- package/src/index_photoviewer.js +0 -6
- package/src/utils/index.js +0 -17
- package/src/utils/index_photoviewer.js +0 -16
- package/tests/components/core/Basic.test.js +0 -168
- package/tests/components/core/BasicMock.js +0 -25
- package/tests/components/core/CoverageMap.test.js +0 -20
- package/tests/components/core/Editor.test.js +0 -20
- package/tests/components/core/PhotoViewer.test.js +0 -57
- package/tests/components/core/Viewer.test.js +0 -85
- package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +0 -96
- package/tests/components/core/__snapshots__/Viewer.test.js.snap +0 -188
- package/tests/components/ui/CopyButton.test.js +0 -52
- package/tests/components/ui/Loader.test.js +0 -55
- package/tests/components/ui/Map.test.js +0 -145
- package/tests/components/ui/Photo.test.js +0 -437
- package/tests/components/ui/Popup.test.js +0 -26
- package/tests/components/ui/QualityScore.test.js +0 -18
- package/tests/components/ui/SearchBar.test.js +0 -110
- package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +0 -33
- package/tests/components/ui/__snapshots__/Loader.test.js.snap +0 -56
- package/tests/components/ui/__snapshots__/Map.test.js.snap +0 -16
- package/tests/components/ui/__snapshots__/Photo.test.js.snap +0 -263
- package/tests/components/ui/__snapshots__/Popup.test.js.snap +0 -29
- package/tests/components/ui/__snapshots__/QualityScore.test.js.snap +0 -11
- package/tests/components/ui/__snapshots__/SearchBar.test.js.snap +0 -65
- package/tests/data/Map_geocoder_ban.json +0 -36
- package/tests/data/Map_geocoder_nominatim.json +0 -41
- package/tests/data/Viewer_pictures_1.json +0 -148
- package/tests/setupTests.js +0 -5
- package/tests/utils/API.test.js +0 -752
- package/tests/utils/InitParameters.test.js +0 -599
- package/tests/utils/MapStyleComposer.test.js +0 -697
- package/tests/utils/PresetsManager.test.js +0 -123
- package/tests/utils/URLHandler.test.js +0 -587
- package/tests/utils/__snapshots__/API.test.js.snap +0 -40
- package/tests/utils/__snapshots__/MapStyleComposer.test.js.snap +0 -767
- package/tests/utils/__snapshots__/URLHandler.test.js.snap +0 -21
- package/tests/utils/__snapshots__/geocoder.test.js.snap +0 -37
- package/tests/utils/__snapshots__/map.test.js.snap +0 -1249
- package/tests/utils/__snapshots__/picture.test.js.snap +0 -327
- package/tests/utils/__snapshots__/widgets.test.js.snap +0 -19
- package/tests/utils/geocoder.test.js +0 -37
- package/tests/utils/i18n.test.js +0 -111
- package/tests/utils/map.test.js +0 -200
- package/tests/utils/picture.test.js +0 -745
- package/tests/utils/semantics.test.js +0 -174
- package/tests/utils/utils.test.js +0 -358
- package/tests/utils/widgets.test.js +0 -31
- /package/{src → build}/components/core/Basic.css +0 -0
- /package/{src → build}/components/core/CoverageMap.css +0 -0
- /package/{src → build}/components/core/Editor.css +0 -0
- /package/{src → build}/components/core/PhotoViewer.css +0 -0
- /package/{src → build}/components/core/Viewer.css +0 -0
- /package/{src → build}/components/ui/ButtonGroup.css +0 -0
- /package/{src → build}/components/ui/Map.css +0 -0
- /package/{src → build}/components/ui/Photo.css +0 -0
- /package/{src → build}/components/ui/ProgressBar.js +0 -0
- /package/{src → build}/components/ui/widgets/GeoSearch.css +0 -0
- /package/{src → build}/components/ui/widgets/LevelSelect.css +0 -0
- /package/{src → build}/components/ui/widgets/Player.css +0 -0
- /package/{public → build}/favicon.ico +0 -0
- /package/{src → build}/img/arrow_360.svg +0 -0
- /package/{src → build}/img/arrow_flat.svg +0 -0
- /package/{src → build}/img/bg_aerial.jpg +0 -0
- /package/{src → build}/img/bg_streets.jpg +0 -0
- /package/{src → build}/img/loader_base.jpg +0 -0
- /package/{src → build}/img/logo_dead.svg +0 -0
- /package/{src → build}/img/marker.svg +0 -0
- /package/{src → build}/img/marker_blue.svg +0 -0
- /package/{src → build}/img/osm.svg +0 -0
- /package/{src → build}/img/panoramax.svg +0 -0
- /package/{src → build}/img/switch_big.svg +0 -0
- /package/{src → build}/img/switch_mini.svg +0 -0
- /package/{src → build}/img/wd.svg +0 -0
- /package/{src → build}/translations/ar.json +0 -0
- /package/{src → build}/translations/be.json +0 -0
- /package/{src → build}/translations/br.json +0 -0
- /package/{src → build}/translations/cy.json +0 -0
- /package/{src → build}/translations/da.json +0 -0
- /package/{src → build}/translations/de.json +0 -0
- /package/{src → build}/translations/en.json +0 -0
- /package/{src → build}/translations/eo.json +0 -0
- /package/{src → build}/translations/es.json +0 -0
- /package/{src → build}/translations/fi.json +0 -0
- /package/{src → build}/translations/fr.json +0 -0
- /package/{src → build}/translations/hu.json +0 -0
- /package/{src → build}/translations/it.json +0 -0
- /package/{src → build}/translations/ja.json +0 -0
- /package/{src → build}/translations/ko.json +0 -0
- /package/{src → build}/translations/nl.json +0 -0
- /package/{src → build}/translations/nn.json +0 -0
- /package/{src → build}/translations/pl.json +0 -0
- /package/{src → build}/translations/pt.json +0 -0
- /package/{src → build}/translations/pt_BR.json +0 -0
- /package/{src → build}/translations/sv.json +0 -0
- /package/{src → build}/translations/ti.json +0 -0
- /package/{src → build}/translations/tr.json +0 -0
- /package/{src → build}/translations/uk.json +0 -0
- /package/{src → build}/translations/zh_Hant.json +0 -0
- /package/{src → build}/utils/PanoraMapProtocol.js +0 -0
- /package/{src → build}/utils/services.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isPanoramaxEndpointSingleUser } from "./map";
|
|
1
|
+
import { isPanoramaxEndpointSingleUser } from "./map.js";
|
|
2
2
|
|
|
3
3
|
export const MAP_FILTERS_JS2URL = {
|
|
4
4
|
"minDate": "date_from",
|
|
@@ -33,13 +33,13 @@ function filterMapLibreOptions(opts) {
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Merges all URL parameters and component attributes into a single set of coherent settings.
|
|
36
|
-
*
|
|
36
|
+
*
|
|
37
37
|
* @class Panoramax.utils.InitParameters
|
|
38
38
|
* @param {object} [componentAttrs] HTML attributes from parent component
|
|
39
39
|
* @param {object} [urlParams] Parameters extracted from URL
|
|
40
40
|
* @param {object} [browserStorage] Parameters read from local/session storage
|
|
41
41
|
*/
|
|
42
|
-
export default class InitParameters {
|
|
42
|
+
export default class InitParameters {
|
|
43
43
|
constructor(componentAttrs = {}, urlParams = {}, browserStorage = {}) {
|
|
44
44
|
// Skip URL parameters if disabled by component
|
|
45
45
|
if(componentAttrs["url-parameters"] === "false") { urlParams = {}; }
|
|
@@ -72,8 +72,8 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
|
|
|
72
72
|
let map_zoom = urlMap?.zoom || componentMap.zoom || browserMap?.zoom;
|
|
73
73
|
let map_pitch = urlMap?.pitch || componentMap.pitch;
|
|
74
74
|
let map_bearing = urlMap?.bearing || componentMap.bearing;
|
|
75
|
-
let map_indoor_level = urlParams.level || componentMap.indoor?.level;
|
|
76
|
-
|
|
75
|
+
let map_indoor_level = urlParams.level || componentMap.indoor?.level;
|
|
76
|
+
|
|
77
77
|
// - Component only
|
|
78
78
|
let geocoder = componentAttrs.geocoder;
|
|
79
79
|
let widgets = componentAttrs.widgets;
|
|
@@ -116,8 +116,8 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
|
|
|
116
116
|
console.warn("Parameter focus can't be 'map' as map is disabled");
|
|
117
117
|
focus = "pic";
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
if(map_background
|
|
119
|
+
|
|
120
|
+
if(map_background === "aerial" && !map_raster) {
|
|
121
121
|
console.warn("Parameter background can't be 'aerial' as no aerial imagery is available");
|
|
122
122
|
map_background = "streets";
|
|
123
123
|
}
|
|
@@ -266,6 +266,7 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
|
|
|
266
266
|
const props = {};
|
|
267
267
|
for(let classK in compClass.properties) {
|
|
268
268
|
let classV = compClass.properties[classK];
|
|
269
|
+
// eslint-disable-next-line eqeqeq
|
|
269
270
|
if(!classV.state && comp[classK] != null) {
|
|
270
271
|
props[classK] = comp[classK];
|
|
271
272
|
}
|
|
@@ -333,7 +334,7 @@ export function xywhParamToPSVPosition(str, picmeta) {
|
|
|
333
334
|
let basePanoData = picmeta.panorama.basePanoData;
|
|
334
335
|
if(typeof basePanoData === "function") {
|
|
335
336
|
const size = picmeta?.properties?.["pers:interior_orientation"]?.sensor_array_dimensions;
|
|
336
|
-
if(size && size.length
|
|
337
|
+
if(size && size.length === 2) { basePanoData = basePanoData({width: size[0], height: size[1]}); }
|
|
337
338
|
else { basePanoData = null; }
|
|
338
339
|
}
|
|
339
340
|
|
|
@@ -436,7 +437,7 @@ export function alterPSVState(psv, params) {
|
|
|
436
437
|
* @param {Map} map The MapLibre component to change.
|
|
437
438
|
* @param {object} params The parameters to apply.
|
|
438
439
|
*/
|
|
439
|
-
export
|
|
440
|
+
export function alterMapState(map, params) {
|
|
440
441
|
// Map position
|
|
441
442
|
const mapOpts = getMapPositionFromString(params.map, map);
|
|
442
443
|
if(mapOpts) {
|
|
@@ -508,6 +509,7 @@ export function alterViewerState(viewer, params) {
|
|
|
508
509
|
}
|
|
509
510
|
|
|
510
511
|
// Change users
|
|
512
|
+
// eslint-disable-next-line eqeqeq
|
|
511
513
|
if(params.users != null) {
|
|
512
514
|
if(isPanoramaxEndpointSingleUser(params.users)) {
|
|
513
515
|
viewer.mapStyleComposer._createPanoramaxEndpointForUser(params.users);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./map";
|
|
6
|
-
import { autoDetectLocale } from "./i18n";
|
|
7
|
-
import { COLORS, getUserAccount } from "./utils";
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line import/no-unused-modules
|
|
2
|
+
MAP_EXPR_QUALITYSCORE, MAP_EXPR_QUALITYSCORE_GPS, MAP_THEMES_STYLES, RASTER_LAYER_ID,
|
|
3
|
+
TILES_PICTURES_ZOOM, getPanoramaxLayers, hasStyleLoggedGridStats,
|
|
4
|
+
isLabelLayer, isPanoramaxEndpointSingleUser, switchCoefValue,
|
|
5
|
+
} from "./map.js";
|
|
6
|
+
import { autoDetectLocale } from "./i18n.js";
|
|
7
|
+
import { COLORS, getUserAccount } from "./utils.js";
|
|
8
|
+
|
|
10
9
|
export const BASEMAPS_DEFAULT_IDS = ["streets", "aerial"];
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -102,6 +101,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
102
101
|
if(Array.isArray(s)) {
|
|
103
102
|
sprite = sprite.concat(s);
|
|
104
103
|
}
|
|
104
|
+
// eslint-disable-next-line eqeqeq
|
|
105
105
|
else if(typeof s === "object" && s != null) {
|
|
106
106
|
sprite.push(s);
|
|
107
107
|
}
|
|
@@ -176,8 +176,8 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
176
176
|
*/
|
|
177
177
|
|
|
178
178
|
// OSMFR PMTiles (capital cities)
|
|
179
|
-
const citiesLayer = labelLayers.find(l => l.id
|
|
180
|
-
let capitalLayer = labelLayers.find(l => l.id
|
|
179
|
+
const citiesLayer = labelLayers.find(l => l.id === "place_label_city");
|
|
180
|
+
let capitalLayer = labelLayers.find(l => l.id === "place_label_capital");
|
|
181
181
|
if(citiesLayer && !capitalLayer) {
|
|
182
182
|
// Create capital layer from original city style
|
|
183
183
|
citiesLayer.paint = {
|
|
@@ -189,11 +189,11 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
189
189
|
citiesLayer.layout["text-letter-spacing"] = 0.1;
|
|
190
190
|
capitalLayer = JSON.parse(JSON.stringify(citiesLayer));
|
|
191
191
|
capitalLayer.id = "place_label_capital";
|
|
192
|
-
capitalLayer.filter = capitalLayer.filter.filter(f => !(f[0] === ">" && f[1]
|
|
192
|
+
capitalLayer.filter = capitalLayer.filter.filter(f => !(f[0] === ">" && f[1] === "capital"));
|
|
193
193
|
capitalLayer.filter.push(["<=", "capital", 2]);
|
|
194
194
|
|
|
195
195
|
// Edit original city to make it less important
|
|
196
|
-
if(!citiesLayer.filter.find(f => f[0] === ">" && f[1]
|
|
196
|
+
if(!citiesLayer.filter.find(f => f[0] === ">" && f[1] === "capital")) {
|
|
197
197
|
citiesLayer.filter.push([">", "capital", 2]);
|
|
198
198
|
}
|
|
199
199
|
labelLayers.push(capitalLayer);
|
|
@@ -291,7 +291,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
291
291
|
if(layer.source === "indoorequal" && layer.id === "indoor-heat" && this._parent?._initParams?.getMapInit()?.indoor?.heatmap === false) {
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
|
|
295
295
|
// Look for source in existing layers for appropriate layerRange
|
|
296
296
|
let found = false;
|
|
297
297
|
Object
|
|
@@ -303,7 +303,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
303
303
|
found = true;
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
|
-
|
|
306
|
+
|
|
307
307
|
if(found) { return; }
|
|
308
308
|
|
|
309
309
|
// If none found, add it
|
|
@@ -330,10 +330,10 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
330
330
|
*/
|
|
331
331
|
async waitFor(type, id) {
|
|
332
332
|
if(this.layerRanges[type][id]) {
|
|
333
|
-
return Promise.resolve();
|
|
333
|
+
return await Promise.resolve();
|
|
334
334
|
}
|
|
335
335
|
else {
|
|
336
|
-
return new Promise(resolve => setTimeout(resolve, 250)).then(() => this.waitFor(type, id));
|
|
336
|
+
return await new Promise(resolve => setTimeout(resolve, 250)).then(() => this.waitFor(type, id));
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
|
|
@@ -382,7 +382,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
382
382
|
*/
|
|
383
383
|
this.dispatchEvent(new CustomEvent("basemap-changed", { detail: { basemap: id } }));
|
|
384
384
|
}
|
|
385
|
-
|
|
385
|
+
|
|
386
386
|
/**
|
|
387
387
|
* Does this style contain many different basemaps ?
|
|
388
388
|
* @returns {boolean} True if 2 or more basemaps are available
|
|
@@ -398,6 +398,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
398
398
|
* @memberof Panoramax.utils.MapStyleComposer#
|
|
399
399
|
*/
|
|
400
400
|
hasStreetsAerialBasemaps() {
|
|
401
|
+
// eslint-disable-next-line eqeqeq
|
|
401
402
|
return this.layerRanges.basemaps.aerial != null && this.layerRanges.basemaps.streets != null;
|
|
402
403
|
}
|
|
403
404
|
|
|
@@ -407,6 +408,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
407
408
|
* @memberof Panoramax.utils.MapStyleComposer#
|
|
408
409
|
*/
|
|
409
410
|
hasComplementaryBasemaps() {
|
|
411
|
+
// eslint-disable-next-line eqeqeq
|
|
410
412
|
return Object.keys(this.layerRanges.basemaps).find(b => !BASEMAPS_DEFAULT_IDS.includes(b)) != null;
|
|
411
413
|
}
|
|
412
414
|
|
|
@@ -632,12 +634,12 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
632
634
|
this.addPanoramaxEndpoint(id, style, switchOn);
|
|
633
635
|
}
|
|
634
636
|
}
|
|
635
|
-
|
|
637
|
+
|
|
636
638
|
/** @private */
|
|
637
639
|
async _createPanoramaxEndpointForUser(userId) {
|
|
638
640
|
// Skip if user ID is invalid
|
|
639
641
|
if(!isPanoramaxEndpointSingleUser(userId)) { return; }
|
|
640
|
-
|
|
642
|
+
|
|
641
643
|
// Skip if it already exist
|
|
642
644
|
if(this.layerRanges.panoramax[userId]) {
|
|
643
645
|
this.switchPanoramaxEndpoint(userId);
|
|
@@ -656,7 +658,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
656
658
|
api = this._parent.api;
|
|
657
659
|
apiUserId = userId;
|
|
658
660
|
}
|
|
659
|
-
|
|
661
|
+
|
|
660
662
|
// Find style from API
|
|
661
663
|
if(api._endpoints.user_style) { // API user style JSON
|
|
662
664
|
style = api._endpoints.user_style.replace(/\{userId\}/g, apiUserId);
|
|
@@ -666,7 +668,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
666
668
|
"tiles": [ api._endpoints.user_tiles.replace(/\{userId\}/g, apiUserId) ]
|
|
667
669
|
} } };
|
|
668
670
|
}
|
|
669
|
-
|
|
671
|
+
|
|
670
672
|
// Load from URL
|
|
671
673
|
if(style && typeof style === "string") {
|
|
672
674
|
style = await fetch(style, api._getFetchOptions()).then(res => res.json());
|
|
@@ -773,7 +775,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
773
775
|
|
|
774
776
|
// -- Color --
|
|
775
777
|
const layerColor = ["case", ["==", ["get", "hidden"], true], COLORS.HIDDEN];
|
|
776
|
-
|
|
778
|
+
|
|
777
779
|
// Selected sequence style
|
|
778
780
|
if(isSequences && seqId) {
|
|
779
781
|
layerColor.push(["==", ["get", "id"], seqId], COLORS.SELECTED);
|
|
@@ -781,7 +783,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
781
783
|
else if(isPictures && seqId) {
|
|
782
784
|
layerColor.push(["in", seqId, ["get", "sequences"]], COLORS.SELECTED);
|
|
783
785
|
}
|
|
784
|
-
|
|
786
|
+
|
|
785
787
|
layerColor.push(...MAP_THEMES_STYLES[this.panoramaxTheme].color);
|
|
786
788
|
layer.paint[`${isPictures ? "circle" : "line"}-color`] = layerColor;
|
|
787
789
|
if(isPictures) { layer.paint["circle-stroke-color"] = layerColor; }
|
|
@@ -790,7 +792,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
790
792
|
if(isGrid) {
|
|
791
793
|
let newType = "coef";
|
|
792
794
|
if(this.panoramaxFilters.pic_type) {
|
|
793
|
-
newType = this.panoramaxFilters.pic_type
|
|
795
|
+
newType = this.panoramaxFilters.pic_type === "flat" ? "coef_flat_pictures" : "coef_360_pictures";
|
|
794
796
|
if(hasStyleLoggedGridStats(style) && getUserAccount()) {
|
|
795
797
|
newType = "logged_" + newType;
|
|
796
798
|
}
|
|
@@ -811,18 +813,18 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
811
813
|
layers.forEach(layer => {
|
|
812
814
|
const isPictures = layer.id.endsWith("_pictures");
|
|
813
815
|
const isSequences = layer.id.endsWith("_sequences") || layer.id.endsWith("_sequences_plus");
|
|
814
|
-
|
|
816
|
+
|
|
815
817
|
if(!isPictures && !isSequences) { return; }
|
|
816
818
|
let layerFilters = [];
|
|
817
|
-
|
|
819
|
+
|
|
818
820
|
if(pf.minDate && pf.minDate !== "") {
|
|
819
821
|
if(isPictures) { layerFilters.push([">=", ["get", "ts"], pf.minDate]); }
|
|
820
822
|
else if(isSequences) { layerFilters.push([">=", ["get", "date"], pf.minDate]); }
|
|
821
823
|
}
|
|
822
|
-
|
|
824
|
+
|
|
823
825
|
if(pf.maxDate && pf.maxDate !== "") {
|
|
824
826
|
if(isSequences) { layerFilters.push(["<=", ["get", "date"], pf.maxDate]); }
|
|
825
|
-
|
|
827
|
+
|
|
826
828
|
// Get tomorrow date for pictures filtering
|
|
827
829
|
// (because ts is date+time, so comparing date only string would fail otherwise)
|
|
828
830
|
if(isPictures) {
|
|
@@ -832,23 +834,23 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
832
834
|
layerFilters.push(["<=", ["get", "ts"], d]);
|
|
833
835
|
}
|
|
834
836
|
}
|
|
835
|
-
|
|
837
|
+
|
|
836
838
|
if(pf.pic_type && pf.pic_type !== "") {
|
|
837
839
|
pf.pic_type = pf.pic_type === "flat" ? "flat" : "equirectangular";
|
|
838
840
|
if(isSequences) { layerFilters.push(["==", ["get", "type"], pf.pic_type]); }
|
|
839
841
|
else if(isPictures) { layerFilters.push(["==", ["get", "type"], pf.pic_type]); }
|
|
840
842
|
}
|
|
841
|
-
|
|
843
|
+
|
|
842
844
|
if(pf.qualityscore && pf.qualityscore.length > 0) {
|
|
843
845
|
if(isSequences) { layerFilters.push(["in", MAP_EXPR_QUALITYSCORE, ["literal", pf.qualityscore]]); }
|
|
844
846
|
else if (isPictures) { layerFilters.push(["in", MAP_EXPR_QUALITYSCORE, ["literal", pf.qualityscore]]); }
|
|
845
847
|
}
|
|
846
|
-
|
|
848
|
+
|
|
847
849
|
if(pf.gps && pf.gps.length > 0) {
|
|
848
850
|
if(isSequences) { layerFilters.push(["in", MAP_EXPR_QUALITYSCORE_GPS, ["literal", pf.gps]]); }
|
|
849
851
|
else if(isPictures) { layerFilters.push(["in", MAP_EXPR_QUALITYSCORE_GPS, ["literal", pf.gps]]); }
|
|
850
852
|
}
|
|
851
|
-
|
|
853
|
+
|
|
852
854
|
if(isPictures && pf.featuresRestrictions?.pictures && pf.featuresRestrictions.pictures.features?.length >= 0) {
|
|
853
855
|
if(pf.featuresRestrictions.pictures.rule === "keep") {
|
|
854
856
|
layerFilters.push(["in", ["get", "id"], ["literal", pf.featuresRestrictions.pictures.features]]);
|
|
@@ -857,7 +859,7 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
857
859
|
layerFilters.push(["!", ["in", ["get", "id"], ["literal", pf.featuresRestrictions.pictures.features]]]);
|
|
858
860
|
}
|
|
859
861
|
}
|
|
860
|
-
|
|
862
|
+
|
|
861
863
|
if(isSequences && pf.featuresRestrictions?.sequences && pf.featuresRestrictions.sequences.features?.length >= 0) {
|
|
862
864
|
if(pf.featuresRestrictions.sequences.rule === "keep") {
|
|
863
865
|
layerFilters.push(["in", ["get", "id"], ["literal", pf.featuresRestrictions.sequences.features]]);
|
|
@@ -866,9 +868,9 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
866
868
|
layerFilters.push(["!", ["in", ["get", "id"], ["literal", pf.featuresRestrictions.sequences.features]]]);
|
|
867
869
|
}
|
|
868
870
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
if(layerFilters.length
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
if(layerFilters.length === 0) { layerFilters = ["literal", true]; }
|
|
872
874
|
else {
|
|
873
875
|
layerFilters.unshift("all");
|
|
874
876
|
if(isPictures) {
|
|
@@ -884,4 +886,4 @@ export default class MapStyleComposer extends EventTarget {
|
|
|
884
886
|
|
|
885
887
|
return layers;
|
|
886
888
|
}
|
|
887
|
-
}
|
|
889
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PanoramaxPresetsURL } from "./services";
|
|
1
|
+
import { PanoramaxPresetsURL } from "./services.js";
|
|
2
2
|
|
|
3
3
|
// Iconify aliases for whole collections
|
|
4
4
|
const ICON_COLLECTIONS_SUB = {
|
|
@@ -33,7 +33,7 @@ export default class PresetManager {
|
|
|
33
33
|
*/
|
|
34
34
|
async _load(lang) {
|
|
35
35
|
lang = lang?.substring(0, 2) || window.navigator.languages[0]?.substring(0, 2);
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
try {
|
|
38
38
|
const [translationsENRes, translationsLangRes, presetsRes] = await Promise.all([
|
|
39
39
|
fetch(`${PanoramaxPresetsURL()}/translations/en.min.json`),
|
|
@@ -102,7 +102,7 @@ export default class PresetManager {
|
|
|
102
102
|
* @fulfil {object|null} The preset JSON that best matches, or null if no matches
|
|
103
103
|
*/
|
|
104
104
|
async getPreset(f) {
|
|
105
|
-
return this.getPresets(f).then(res => res.shift());
|
|
105
|
+
return await this.getPresets(f).then(res => res.shift());
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
@@ -112,7 +112,7 @@ export default class PresetManager {
|
|
|
112
112
|
* @fulfil {object[]|null} The all JSON presets that best matches, or null if no matches
|
|
113
113
|
*/
|
|
114
114
|
async getPresets(f) {
|
|
115
|
-
return this.onceReady().then(() => {
|
|
115
|
+
return await this.onceReady().then(() => {
|
|
116
116
|
const candidatePresets = Object.values(this._presets).filter(p => {
|
|
117
117
|
if(Object.keys(p.tags).length === 0) { return false; }
|
|
118
118
|
|
|
@@ -81,18 +81,17 @@ export default class SemanticsMapProtocol {
|
|
|
81
81
|
* @memberof Panoramax.utils.SemanticsMapProtocol#
|
|
82
82
|
*/
|
|
83
83
|
tile() {
|
|
84
|
-
return
|
|
84
|
+
return (params, abort) => {
|
|
85
85
|
abort = abort || new AbortController();
|
|
86
86
|
const match = params.url.match(/^sem:\/\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/);
|
|
87
|
-
if (!match) throw new Error("Invalid URL");
|
|
87
|
+
if (!match) {throw new Error("Invalid URL");}
|
|
88
88
|
|
|
89
89
|
// Look for cache
|
|
90
90
|
if(this.tiles.has(params.url)) {
|
|
91
91
|
return { data: this.tiles.get(params.url).buffer.slice(0) };
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
const [_, f, z, x, y] = match;
|
|
94
|
+
const [, f, z, x, y] = match;
|
|
96
95
|
|
|
97
96
|
// Download from API
|
|
98
97
|
const bbox = this._tileToBbox(parseInt(x), parseInt(y), parseInt(z));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./InitParameters";
|
|
4
|
-
import { BASEMAPS_DEFAULT_IDS } from "./MapStyleComposer";
|
|
2
|
+
MAP_FILTERS_JS2URL, alterMapState, alterPSVState, alterPhotoViewerState, alterViewerState
|
|
3
|
+
} from "./InitParameters.js";
|
|
4
|
+
import { BASEMAPS_DEFAULT_IDS } from "./MapStyleComposer.js";
|
|
5
5
|
|
|
6
6
|
// List of supported parameters
|
|
7
7
|
const MANAGED_PARAMETERS = [
|
|
@@ -19,7 +19,7 @@ const UPDATE_MSC_EVENTS = ["filters-changed", "theme-changed", "panoramax-change
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Updates the URL query part with various parent component information.
|
|
22
|
-
*
|
|
22
|
+
*
|
|
23
23
|
* Note that you may call `listenToChanges()` for this class to be effective once parent is ready-enough.
|
|
24
24
|
*
|
|
25
25
|
* @class Panoramax.utils.URLHandler
|
|
@@ -66,7 +66,7 @@ export default class URLHandler extends EventTarget {
|
|
|
66
66
|
nextURLParams() {
|
|
67
67
|
let hashParts = {};
|
|
68
68
|
|
|
69
|
-
if(typeof this._parent.psv.getTransitionDuration()
|
|
69
|
+
if(typeof this._parent.psv.getTransitionDuration() === "number") {
|
|
70
70
|
hashParts.speed = this._parent.psv.getTransitionDuration();
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -178,7 +178,7 @@ export default class URLHandler extends EventTarget {
|
|
|
178
178
|
const hash = (readFromHash ? window.location.hash : window.location.search)
|
|
179
179
|
.replace(/^[?#]/, "")
|
|
180
180
|
.replace(/&/g, "&");
|
|
181
|
-
|
|
181
|
+
|
|
182
182
|
// Split the parameter-styled hash into parts and find the value we need
|
|
183
183
|
let keyvals = {};
|
|
184
184
|
hash.split("&").map(
|
|
@@ -188,7 +188,7 @@ export default class URLHandler extends EventTarget {
|
|
|
188
188
|
.forEach(part => {
|
|
189
189
|
keyvals[part[0]] = part[1];
|
|
190
190
|
});
|
|
191
|
-
|
|
191
|
+
|
|
192
192
|
// If hash is compressed
|
|
193
193
|
if(keyvals.s) {
|
|
194
194
|
const shortVals = Object.fromEntries(
|
|
@@ -277,7 +277,7 @@ export default class URLHandler extends EventTarget {
|
|
|
277
277
|
|
|
278
278
|
const center = this._parent.map.getCenter(),
|
|
279
279
|
zoom = Math.round(this._parent.map.getZoom() * 100) / 100,
|
|
280
|
-
//
|
|
280
|
+
// Derived from equation: 512px * 2^z / 360 / 10^d < 0.5px
|
|
281
281
|
precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10),
|
|
282
282
|
m = Math.pow(10, precision),
|
|
283
283
|
lng = Math.round(center.lng * m) / m,
|
|
@@ -286,8 +286,8 @@ export default class URLHandler extends EventTarget {
|
|
|
286
286
|
pitch = this._parent.map.getPitch();
|
|
287
287
|
let hash = `${zoom}/${lat}/${lng}`;
|
|
288
288
|
|
|
289
|
-
if (bearing || pitch) hash += (`/${Math.round(bearing * 10) / 10}`);
|
|
290
|
-
if (pitch) hash += (`/${Math.round(pitch)}`);
|
|
289
|
+
if (bearing || pitch) {hash += (`/${Math.round(bearing * 10) / 10}`);}
|
|
290
|
+
if (pitch) {hash += (`/${Math.round(pitch)}`);}
|
|
291
291
|
|
|
292
292
|
return hash;
|
|
293
293
|
}
|
|
@@ -315,7 +315,7 @@ export default class URLHandler extends EventTarget {
|
|
|
315
315
|
|
|
316
316
|
if(this._parent.getClassName() === "Viewer") { alterViewerState(this._parent, vals); }
|
|
317
317
|
else { alterPhotoViewerState(this._parent, vals); }
|
|
318
|
-
|
|
318
|
+
|
|
319
319
|
alterPSVState(this._parent.psv, vals);
|
|
320
320
|
if(this._parent.map) { alterMapState(this._parent.map, vals); }
|
|
321
321
|
}
|
|
@@ -349,6 +349,7 @@ export default class URLHandler extends EventTarget {
|
|
|
349
349
|
l: hashParts.level,
|
|
350
350
|
};
|
|
351
351
|
const short = Object.entries(shortVals)
|
|
352
|
+
// eslint-disable-next-line eqeqeq
|
|
352
353
|
.filter(([,v]) => v != undefined && v != "")
|
|
353
354
|
.map(([k,v]) => `${k}${v}`)
|
|
354
355
|
.join(";");
|
|
@@ -389,13 +390,14 @@ export default class URLHandler extends EventTarget {
|
|
|
389
390
|
if(Object.keys(this.currentURLParams(true)).length > 0) { nextUrl.hash = ""; }
|
|
390
391
|
|
|
391
392
|
// Skip hash update if no changes
|
|
392
|
-
if(prevUrl.search
|
|
393
|
+
if(prevUrl.search === nextUrl.search) { return; }
|
|
393
394
|
|
|
394
395
|
const prevPic = this.currentURLParams().pic || "";
|
|
395
396
|
const nextPic = this._parent?.psv?.getPictureId?.() || "";
|
|
396
397
|
|
|
397
398
|
try {
|
|
398
399
|
// If different pic, add entry in browser history
|
|
400
|
+
// eslint-disable-next-line eqeqeq
|
|
399
401
|
if(prevPic != nextPic) {
|
|
400
402
|
window.history.pushState(window.history.state, null, nextUrl.href);
|
|
401
403
|
}
|
|
@@ -403,7 +405,7 @@ export default class URLHandler extends EventTarget {
|
|
|
403
405
|
else {
|
|
404
406
|
window.history.replaceState(window.history.state, null, nextUrl.href);
|
|
405
407
|
}
|
|
406
|
-
|
|
408
|
+
|
|
407
409
|
if(this._parent) {
|
|
408
410
|
/**
|
|
409
411
|
* URL changed event
|
|
@@ -416,7 +418,7 @@ export default class URLHandler extends EventTarget {
|
|
|
416
418
|
}
|
|
417
419
|
} catch (SecurityError) {
|
|
418
420
|
// IE11 does not allow this if the page is within an iframe created
|
|
419
|
-
//
|
|
421
|
+
// With iframe.contentWindow.document.write(...).
|
|
420
422
|
// https://github.com/mapbox/mapbox-gl-js/issues/7410
|
|
421
423
|
}
|
|
422
424
|
}, 500);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AdresseDataGouvBaseURL, NominatimBaseUrl } from "./services.js";
|
|
2
2
|
|
|
3
3
|
const PLACETYPE_ZOOM = {
|
|
4
4
|
"house": 20,
|
|
@@ -89,7 +89,7 @@ export function forwardGeocodingBAN(config) {
|
|
|
89
89
|
*/
|
|
90
90
|
function geocodeJsonToPlaceName(props) {
|
|
91
91
|
// API format @ https://github.com/geocoders/geocodejson-spec/blob/master/draft/README.md
|
|
92
|
-
if(!props || typeof props
|
|
92
|
+
if(!props || typeof props !== "object") { return ""; }
|
|
93
93
|
|
|
94
94
|
// P1 = main name, P2=locality-like, P3=country+high-level admin
|
|
95
95
|
let p1 = props.name;
|
|
@@ -153,12 +153,12 @@ function geocodeJsonToPlaceName(props) {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
p2 = p2.filter(v => v);
|
|
156
|
-
p2 = p2.filter((v,i) => v
|
|
156
|
+
p2 = p2.filter((v,i) => v !== p1 && (i === 0 || p2[i-1] !== v));
|
|
157
157
|
p2 = p2.length > 0 ? (props.housenumber ? p2.slice(0,2).join(" ") : p2.shift()) : null;
|
|
158
158
|
if(p2 === p1) { p2 = null; }
|
|
159
159
|
|
|
160
160
|
p3 = p3.filter(v => v);
|
|
161
|
-
p3 = p3.filter((v,i) => v
|
|
161
|
+
p3 = p3.filter((v,i) => v !== p1 && (!p2 || !p2.includes(v)) && (i === 0 || p3[i-1] !== v));
|
|
162
162
|
|
|
163
163
|
let res = [p1, p2, p3.shift()].filter(v => v);
|
|
164
164
|
|
|
@@ -188,7 +188,7 @@ export function forwardGeocodingStandard(config, endpoint) {
|
|
|
188
188
|
const listedNames = [];
|
|
189
189
|
(res.features || []).forEach(f => {
|
|
190
190
|
const plname = geocodeJsonToPlaceName(f.properties);
|
|
191
|
-
if(!listedNames.includes(plname) && f.properties.type
|
|
191
|
+
if(!listedNames.includes(plname) && f.properties.type !== "other") {
|
|
192
192
|
finalRes.features.push({
|
|
193
193
|
place_type: ["place"],
|
|
194
194
|
place_name: plname,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import T_be from "../translations/be.json";
|
|
2
|
-
import T_da from "../translations/da.json";
|
|
3
|
-
import T_de from "../translations/de.json";
|
|
4
|
-
import T_en from "../translations/en.json";
|
|
5
|
-
import T_eo from "../translations/eo.json";
|
|
6
|
-
import T_es from "../translations/es.json";
|
|
7
|
-
import T_fr from "../translations/fr.json";
|
|
8
|
-
import T_hu from "../translations/hu.json";
|
|
9
|
-
import T_it from "../translations/it.json";
|
|
10
|
-
import T_ja from "../translations/ja.json";
|
|
11
|
-
import T_nl from "../translations/nl.json";
|
|
12
|
-
import T_pl from "../translations/pl.json";
|
|
13
|
-
import T_pt from "../translations/pt.json";
|
|
14
|
-
import T_pt_BR from "../translations/pt_BR.json";
|
|
15
|
-
import T_sv from "../translations/sv.json";
|
|
16
|
-
import T_tr from "../translations/tr.json";
|
|
17
|
-
import T_uk from "../translations/uk.json";
|
|
18
|
-
import T_zh_Hant from "../translations/zh_Hant.json";
|
|
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_hu from "../translations/hu.json" with { type: "json" };
|
|
9
|
+
import T_it from "../translations/it.json" with { type: "json" };
|
|
10
|
+
import T_ja from "../translations/ja.json" with { type: "json" };
|
|
11
|
+
import T_nl from "../translations/nl.json" with { type: "json" };
|
|
12
|
+
import T_pl from "../translations/pl.json" with { type: "json" };
|
|
13
|
+
import T_pt from "../translations/pt.json" with { type: "json" };
|
|
14
|
+
import T_pt_BR from "../translations/pt_BR.json" with { type: "json" };
|
|
15
|
+
import T_sv from "../translations/sv.json" with { type: "json" };
|
|
16
|
+
import T_tr from "../translations/tr.json" with { type: "json" };
|
|
17
|
+
import T_uk from "../translations/uk.json" with { type: "json" };
|
|
18
|
+
import T_zh_Hant from "../translations/zh_Hant.json" with { type: "json" };
|
|
19
19
|
|
|
20
20
|
const FALLBACK_LOCALE = "en";
|
|
21
21
|
const TRANSLATIONS = {
|
|
@@ -31,7 +31,7 @@ const TRANSLATIONS = {
|
|
|
31
31
|
* @returns The best matching language (in lowercase)
|
|
32
32
|
* @private
|
|
33
33
|
*/
|
|
34
|
-
export function autoDetectLocale(supportedTranslations, fallback) {
|
|
34
|
+
export function autoDetectLocale(supportedTranslations, fallback) {
|
|
35
35
|
supportedTranslations = supportedTranslations.map(k => k.toLowerCase());
|
|
36
36
|
|
|
37
37
|
for (const navigatorLang of window.navigator.languages) {
|
|
@@ -71,7 +71,7 @@ export function autoDetectLocale(supportedTranslations, fallback) { // eslint-ig
|
|
|
71
71
|
export function getTranslations(lang = "") {
|
|
72
72
|
const myTr = JSON.parse(JSON.stringify(T_en));
|
|
73
73
|
let preferedTr;
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
// No specific lang set -> use browser lang
|
|
76
76
|
if(!lang) {
|
|
77
77
|
lang = autoDetectLocale(Object.keys(TRANSLATIONS), FALLBACK_LOCALE);
|
|
@@ -92,6 +92,7 @@ export function getTranslations(lang = "") {
|
|
|
92
92
|
if(preferedTr) {
|
|
93
93
|
Object.entries(preferedTr).forEach(([k1, k2]) => {
|
|
94
94
|
Object.entries(k2).forEach(([k2, k3]) => {
|
|
95
|
+
// eslint-disable-next-line eqeqeq
|
|
95
96
|
if(Array.isArray(k3)) { k3 = k3.filter(v => v != null); }
|
|
96
97
|
myTr[k1][k2] = k3;
|
|
97
98
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
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";
|
|
@@ -0,0 +1,14 @@
|
|
|
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";
|