@panoramax/web-viewer 4.0.3 → 4.1.0-develop-55fdf56c
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/CHANGELOG.md +46 -1
- package/build/index.css +9 -9
- package/build/index.css.map +1 -1
- package/build/index.js +640 -456
- package/build/index.js.map +1 -1
- package/build/map.html +1 -1
- package/build/photo.html +1 -1
- package/build/viewer.html +3 -3
- package/build/widgets.html +1 -1
- package/config/jest/mocks.js +9 -1
- package/docs/03_URL_settings.md +21 -0
- package/docs/09_Develop.md +6 -0
- package/docs/images/comparative_3drender.jpg +0 -0
- package/docs/index.md +13 -0
- package/docs/reference/components/core/Editor.md +18 -0
- package/docs/reference/components/core/PhotoViewer.md +1 -0
- package/docs/reference/components/core/Viewer.md +1 -0
- package/docs/reference/components/menus/MapLegend.md +17 -0
- package/docs/reference/components/menus/MiniPictureLegend.md +15 -0
- package/docs/reference/components/menus/PictureLegend.md +17 -0
- package/docs/reference/components/ui/AnnotationsSwitch.md +15 -0
- package/docs/reference/components/ui/Button.md +1 -1
- package/docs/reference/components/ui/CopyButton.md +1 -1
- package/docs/reference/components/ui/LinkButton.md +1 -1
- package/docs/reference/components/ui/Map.md +18 -2
- package/docs/reference/components/ui/MapMore.md +6 -2
- package/docs/reference/components/ui/SemanticsEditor.md +87 -0
- package/docs/reference/components/ui/widgets/Legend.md +5 -4
- package/docs/reference/utils/URLHandler.md +7 -0
- package/docs/reference.md +3 -1
- package/docs/tutorials/aerial_imagery.md +13 -11
- package/mkdocs.yml +3 -1
- package/package.json +7 -7
- package/public/map.html +3 -3
- package/public/photo.html +1 -1
- package/public/viewer.html +3 -3
- package/public/widgets.html +32 -0
- package/src/components/core/Basic.css +2 -0
- package/src/components/core/Basic.js +3 -1
- package/src/components/core/CoverageMap.css +1 -0
- package/src/components/core/CoverageMap.js +6 -0
- package/src/components/core/Editor.css +2 -0
- package/src/components/core/Editor.js +56 -7
- package/src/components/core/PhotoViewer.css +10 -10
- package/src/components/core/PhotoViewer.js +56 -23
- package/src/components/core/Viewer.css +16 -4
- package/src/components/core/Viewer.js +62 -33
- package/src/components/layout/BottomDrawer.js +2 -1
- package/src/components/layout/Tabs.js +4 -0
- package/src/components/menus/AnnotationsList.js +13 -9
- package/src/components/menus/MapBackground.js +8 -3
- package/src/components/menus/MapFilters.js +11 -2
- package/src/components/menus/MapLayers.js +3 -2
- package/src/components/menus/MapLegend.js +35 -4
- package/src/components/menus/MiniPictureLegend.js +74 -0
- package/src/components/menus/PictureLegend.js +89 -33
- package/src/components/menus/PictureMetadata.js +49 -17
- package/src/components/menus/PlayerOptions.js +3 -3
- package/src/components/menus/Share.js +3 -3
- package/src/components/menus/index.js +5 -4
- package/src/components/styles.js +11 -0
- package/src/components/ui/AnnotationsSwitch.js +171 -0
- package/src/components/ui/Button.js +1 -1
- package/src/components/ui/CopyButton.js +1 -1
- package/src/components/ui/LinkButton.js +1 -1
- package/src/components/ui/Map.css +4 -0
- package/src/components/ui/Map.js +17 -5
- package/src/components/ui/MapMore.js +61 -25
- package/src/components/ui/Photo.css +11 -2
- package/src/components/ui/Photo.js +6 -3
- package/src/components/ui/SemanticsEditor.js +157 -0
- package/src/components/ui/index.js +2 -1
- package/src/components/ui/widgets/GeoSearch.js +3 -2
- package/src/components/ui/widgets/Legend.js +76 -15
- package/src/components/ui/widgets/MapFiltersButton.js +3 -3
- package/src/components/ui/widgets/MapLayersButton.js +3 -3
- package/src/components/ui/widgets/OSMEditors.js +2 -2
- package/src/components/ui/widgets/PictureLegendActions.js +24 -42
- package/src/components/ui/widgets/Player.js +3 -3
- package/src/components/ui/widgets/Zoom.js +4 -2
- package/src/translations/ar.json +1 -0
- package/src/translations/da.json +3 -2
- package/src/translations/de.json +64 -13
- package/src/translations/en.json +5 -1
- package/src/translations/eo.json +32 -2
- package/src/translations/fr.json +7 -1
- package/src/translations/it.json +33 -2
- package/src/translations/nl.json +53 -11
- package/src/translations/zh_Hant.json +29 -2
- package/src/utils/API.js +17 -1
- package/src/utils/InitParameters.js +46 -4
- package/src/utils/URLHandler.js +9 -1
- package/src/utils/map.js +24 -1
- package/src/utils/semantics.js +53 -1
- package/src/utils/services.js +16 -0
- package/src/utils/widgets.js +38 -0
- package/tests/components/core/Editor.test.js +1 -1
- package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +18 -6
- package/tests/components/core/__snapshots__/Viewer.test.js.snap +15 -3
- package/tests/components/ui/Photo.test.js +1 -0
- package/tests/components/ui/__snapshots__/Map.test.js.snap +164 -0
- package/tests/utils/InitParameters.test.js +27 -0
- package/tests/utils/map.test.js +12 -0
- package/tests/utils/semantics.test.js +34 -5
- package/docs/reference/components/ui/HashTags.md +0 -15
- package/src/components/ui/HashTags.js +0 -98
|
@@ -190,7 +190,34 @@
|
|
|
190
190
|
"metadata_exif_doc_title": "請參閱 Exiv2 文件以取得 EXIF 和 XMP 標籤定義的完整說明",
|
|
191
191
|
"metadata_location_coordinates": "座標 (經度, 緯度)",
|
|
192
192
|
"metadata_location_copy": "複製 {v}",
|
|
193
|
-
"metadata_location_copy_more": "更多座標複製選項"
|
|
193
|
+
"metadata_location_copy_more": "更多座標複製選項",
|
|
194
|
+
"semantics_title": "標籤",
|
|
195
|
+
"semantics_tags": "{nb} 個標籤",
|
|
196
|
+
"semantics_show_annotations": "顯示相片標註",
|
|
197
|
+
"semantics_show_all_tags": "顯示所有標籤",
|
|
198
|
+
"semantics_key": "索引鍵",
|
|
199
|
+
"semantics_annotation_tooltip": "點擊查看詳情",
|
|
200
|
+
"semantics_features_default_title": "特徵 #{nb}",
|
|
201
|
+
"semantics_features_subtitle": "{nb} 個關聯的屬性",
|
|
202
|
+
"semantics_hide_all_tags": "隱藏所有標籤",
|
|
203
|
+
"semantics_features_none": "此相片尚未檢測到或註釋任何特徵。",
|
|
204
|
+
"semantics_value": "值",
|
|
205
|
+
"semantics_tags_picture_none": "此相片尚未加上任何標籤。",
|
|
206
|
+
"semantics_tags_picture": "相片標籤",
|
|
207
|
+
"whats_panoramax": "Panoramax 是各地相片的地理共享資源。",
|
|
208
|
+
"semantics_features": "偵測到的特徵",
|
|
209
|
+
"semantics_key_doc": "深入了解此索引鍵",
|
|
210
|
+
"semantics_value_doc": "深入了解此標籤",
|
|
211
|
+
"semantics_qualifiers": "限定條件",
|
|
212
|
+
"semantics_hide_annotations": "隱藏相片標註",
|
|
213
|
+
"semantics_zero_annotations": "此相片尚未加上任何標註",
|
|
214
|
+
"semantics_hashtags": "相片主題標籤",
|
|
215
|
+
"semantics_wikidata_properties": {
|
|
216
|
+
"P31": "隸屬於",
|
|
217
|
+
"P279": "上級分類",
|
|
218
|
+
"P361": "所屬實體"
|
|
219
|
+
},
|
|
220
|
+
"panoramax": "Panoramax"
|
|
194
221
|
},
|
|
195
222
|
"map": {
|
|
196
223
|
"loading": "正在載入…",
|
|
@@ -198,7 +225,7 @@
|
|
|
198
225
|
"thumbnail": "遊標懸停相片的縮圖",
|
|
199
226
|
"slow_loading": "地圖載入速度緩慢而且可能出現損壞",
|
|
200
227
|
"more_panoramax": "深入了解 Panoramax",
|
|
201
|
-
"map_data": "地圖資料:"
|
|
228
|
+
"map_data": "地圖資料: {m}"
|
|
202
229
|
},
|
|
203
230
|
"psv": {
|
|
204
231
|
"ctrlZoom": "使用 CTRL + 滑鼠滾輪縮放圖片",
|
package/src/utils/API.js
CHANGED
|
@@ -369,6 +369,22 @@ export default class API extends EventTarget {
|
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Get the withCredentials function for PhotoSphereViewer to handle fetch credentials parameter.
|
|
374
|
+
* @memberOf Panoramax.utils.API#
|
|
375
|
+
* @private
|
|
376
|
+
* @returns {function} The withCredentials function
|
|
377
|
+
*/
|
|
378
|
+
_getPSVWithCredentials() {
|
|
379
|
+
const fetchOpts = this._getFetchOptions();
|
|
380
|
+
if(fetchOpts.credentials === "include") {
|
|
381
|
+
return (url) => url.startsWith(this._endpoint);
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
return undefined;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
372
388
|
/**
|
|
373
389
|
* Get sequence GeoJSON representation
|
|
374
390
|
* @memberOf Panoramax.utils.API#
|
|
@@ -738,7 +754,7 @@ export default class API extends EventTarget {
|
|
|
738
754
|
return fetch(this._endpoints.user_search.replace(/\/search$/, `/${userId}`), this._getFetchOptions())
|
|
739
755
|
.then(res => res.json())
|
|
740
756
|
.then(res => {
|
|
741
|
-
return res?.name || null;
|
|
757
|
+
return res?.label || res?.name || null;
|
|
742
758
|
});
|
|
743
759
|
}
|
|
744
760
|
|
|
@@ -15,7 +15,7 @@ const MAPLIBRE_OPTIONS = [
|
|
|
15
15
|
"boxZoom", "clickTolerance", "collectResourceTiming",
|
|
16
16
|
"cooperativeGestures", "crossSourceCollisions", "doubleClickZoom", "dragPan",
|
|
17
17
|
"dragRotate", "fadeDuration", "failIfMajorPerformanceCaveat", "fitBoundsOptions",
|
|
18
|
-
"hash", "interactive", "
|
|
18
|
+
"hash", "interactive", "localIdeographFontFamily", "locale", "logoPosition",
|
|
19
19
|
"maplibreLogo", "maxBounds", "maxCanvasSize", "maxPitch", "maxTileCacheSize",
|
|
20
20
|
"maxTileCacheZoomLevels", "maxZoom", "minPitch", "minZoom", "pitch", "pitchWithRotate",
|
|
21
21
|
"pixelRatio", "preserveDrawingBuffer", "refreshExpiredTiles", "renderWorldCopies",
|
|
@@ -64,7 +64,7 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
|
|
|
64
64
|
let psv_nav = urlParams.nav || componentPsv?.picturesNavigation;
|
|
65
65
|
let map_theme = urlParams.theme || browserMap?.theme || componentMap.theme;
|
|
66
66
|
let map_background = urlParams.background || browserMap?.background || componentMap.background;
|
|
67
|
-
let map_center = urlMap?.center || browserMap?.center || componentMap.center;
|
|
67
|
+
let map_center = urlMap?.center || (!picture && (browserMap?.center || componentMap.center)) || [0,0];
|
|
68
68
|
let map_zoom = urlMap?.zoom || browserMap?.zoom || componentMap.zoom;
|
|
69
69
|
let map_pitch = urlMap?.pitch || componentMap.pitch;
|
|
70
70
|
let map_bearing = urlMap?.bearing || componentMap.bearing;
|
|
@@ -80,6 +80,7 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
|
|
|
80
80
|
let map_raster = componentMap.raster;
|
|
81
81
|
let map_attribution = componentMap.attributionControl;
|
|
82
82
|
let map_others = filterMapLibreOptions(componentMap);
|
|
83
|
+
let keyboardShortcuts = componentAttrs["keyboard-shortcuts"];
|
|
83
84
|
|
|
84
85
|
// - URL only
|
|
85
86
|
let psv_xyz = urlParams.xyz;
|
|
@@ -88,6 +89,7 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
|
|
|
88
89
|
let map_pic_type = urlParams.pic_type;
|
|
89
90
|
let map_camera = urlParams.camera;
|
|
90
91
|
let map_pic_score = urlParams.pic_score;
|
|
92
|
+
let psv_xywh = urlParams.xywh;
|
|
91
93
|
|
|
92
94
|
// Check coherence
|
|
93
95
|
if(!["map", "pic"].includes(focus)) {
|
|
@@ -108,24 +110,26 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
|
|
|
108
110
|
|
|
109
111
|
// Put all attributes in appropriate container
|
|
110
112
|
this._parentInit = { map, users, fetchOptions, style, lang, endpoint };
|
|
111
|
-
this._parentPostInit = { focus, picture, sequence, geocoder, widgets, forceFocus: true };
|
|
113
|
+
this._parentPostInit = { focus, picture, sequence, geocoder, widgets, forceFocus: true, keyboardShortcuts: true };
|
|
112
114
|
|
|
113
115
|
this._psvInit = Object.fromEntries(
|
|
114
116
|
Object.entries(componentPsv).filter(
|
|
115
117
|
([k,]) => !["transitionDuration", "picturesNavigation"].includes(k)
|
|
116
118
|
)
|
|
117
119
|
);
|
|
120
|
+
|
|
118
121
|
this._psvAny = {
|
|
119
122
|
transitionDuration: psv_speed,
|
|
120
123
|
picturesNavigation: psv_nav,
|
|
121
124
|
};
|
|
122
|
-
this._psvPostInit = { xyz: psv_xyz };
|
|
125
|
+
this._psvPostInit = { xyz: psv_xyz, xywh: psv_xywh };
|
|
123
126
|
|
|
124
127
|
this._mapInit = {
|
|
125
128
|
raster: map_raster,
|
|
126
129
|
attributionControl: map_attribution,
|
|
127
130
|
...map_others
|
|
128
131
|
};
|
|
132
|
+
|
|
129
133
|
this._mapAny = {
|
|
130
134
|
theme: map_theme,
|
|
131
135
|
background: map_background,
|
|
@@ -142,6 +146,13 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
|
|
|
142
146
|
camera: map_camera,
|
|
143
147
|
pic_score: map_pic_score,
|
|
144
148
|
};
|
|
149
|
+
|
|
150
|
+
if(keyboardShortcuts === "false") {
|
|
151
|
+
this._psvInit.keyboard = false;
|
|
152
|
+
this._psvInit.keyboardActions = {};
|
|
153
|
+
this._mapInit.keyboard = false;
|
|
154
|
+
this._parentPostInit.keyboardShortcuts = false;
|
|
155
|
+
}
|
|
145
156
|
}
|
|
146
157
|
|
|
147
158
|
/**
|
|
@@ -270,6 +281,28 @@ export function xyzParamToPSVPosition(str) {
|
|
|
270
281
|
else { return null; }
|
|
271
282
|
}
|
|
272
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Extracts from string xywh position
|
|
286
|
+
* @param {string} str The xywh position as hash string
|
|
287
|
+
* @param {object} [picmeta] The current picture metadata, used to compute zoom based on image size
|
|
288
|
+
* @returns {object} { textureX, textureY, z }
|
|
289
|
+
* @private
|
|
290
|
+
*/
|
|
291
|
+
function xywhParamToPSVPosition(str, picmeta) {
|
|
292
|
+
const loc = (str || "").split(",");
|
|
293
|
+
if (loc.length === 4 && !loc.some(v => isNaN(v))) {
|
|
294
|
+
const size = picmeta?.properties?.["pers:interior_orientation"]?.sensor_array_dimensions;
|
|
295
|
+
const res = {
|
|
296
|
+
textureX: +loc[0] + loc[2] / 2,
|
|
297
|
+
textureY: +loc[1] + loc[3] / 2,
|
|
298
|
+
z: size && size.length == 2 ? (1 - (((loc[2] / size[0]) + (loc[3] / size[1])) / 2)) * 75 : null,
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
return res;
|
|
302
|
+
}
|
|
303
|
+
else { return null; }
|
|
304
|
+
}
|
|
305
|
+
|
|
273
306
|
/**
|
|
274
307
|
* Extracts from hash parsed keys all map filters values
|
|
275
308
|
* @param {*} vals Hash keys
|
|
@@ -305,6 +338,15 @@ export function alterPSVState(psv, params) {
|
|
|
305
338
|
}, {once: true});
|
|
306
339
|
}
|
|
307
340
|
|
|
341
|
+
// Change xywh position
|
|
342
|
+
if(params.xywh) {
|
|
343
|
+
psv.addEventListener("picture-loaded", () => {
|
|
344
|
+
const coords = xywhParamToPSVPosition(params.xywh, psv.getPictureMetadata());
|
|
345
|
+
psv.rotate(coords);
|
|
346
|
+
psv.zoom(coords.z);
|
|
347
|
+
}, {once: true});
|
|
348
|
+
}
|
|
349
|
+
|
|
308
350
|
// Change transitionDuration
|
|
309
351
|
let td = params.transitionDuration || params.speed;
|
|
310
352
|
if(td !== undefined) {
|
package/src/utils/URLHandler.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
// List of supported parameters
|
|
6
6
|
const MANAGED_PARAMETERS = [
|
|
7
7
|
"speed", "nav", "focus", "pic", "xyz", "map",
|
|
8
|
-
"background", "users", "pic_score", "s"
|
|
8
|
+
"background", "users", "pic_score", "s", "xywh",
|
|
9
9
|
].concat(Object.values(MAP_FILTERS_JS2URL));
|
|
10
10
|
|
|
11
11
|
// Events to listen on parent and PSV
|
|
@@ -45,6 +45,14 @@ export default class URLHandler extends EventTarget {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Call this function to stop listening to global events.
|
|
50
|
+
* @memberof Panoramax.utils.URLHandler#
|
|
51
|
+
*/
|
|
52
|
+
destroy() {
|
|
53
|
+
window.removeEventListener("popstate", this._onURLChange);
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
/**
|
|
49
57
|
* Compute next values to insert in URL
|
|
50
58
|
* @returns {object} Query parameters
|
package/src/utils/map.js
CHANGED
|
@@ -95,6 +95,17 @@ export function getThumbGif(lang) {
|
|
|
95
95
|
return thumbGif;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
export function isNullCoordinates(c) {
|
|
99
|
+
return (
|
|
100
|
+
c === null
|
|
101
|
+
|| c === undefined
|
|
102
|
+
|| (Array.isArray(c) && (
|
|
103
|
+
(c.length === 2 && c[0] === 0 && c[1] === 0)
|
|
104
|
+
|| c.length < 2
|
|
105
|
+
))
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
98
109
|
/**
|
|
99
110
|
* Is given layer a label layer.
|
|
100
111
|
*
|
|
@@ -220,6 +231,11 @@ export function combineStyles(parent, options) {
|
|
|
220
231
|
style.layers.push(capitalLayer);
|
|
221
232
|
}
|
|
222
233
|
|
|
234
|
+
// Fix for maxzoom on IGN tiles
|
|
235
|
+
if(style?.sources?.plan_ign) {
|
|
236
|
+
style.sources.plan_ign.maxzoom = 18;
|
|
237
|
+
}
|
|
238
|
+
|
|
223
239
|
return style;
|
|
224
240
|
}
|
|
225
241
|
|
|
@@ -408,7 +424,14 @@ export function linkMapAndPhoto(parent) {
|
|
|
408
424
|
}
|
|
409
425
|
}
|
|
410
426
|
else {
|
|
411
|
-
parent.map.displayPictureMarker(
|
|
427
|
+
parent.map.displayPictureMarker(
|
|
428
|
+
e.detail.lon,
|
|
429
|
+
e.detail.lat,
|
|
430
|
+
parent.psv.getXY().x,
|
|
431
|
+
e.detail.first && !isNullCoordinates(parent._initParams?.getMapPostInit()?.center), // Skip centering if precise coordinates are set from URL
|
|
432
|
+
e.detail.picId
|
|
433
|
+
);
|
|
434
|
+
|
|
412
435
|
if(parent?.isMapWide?.()) {
|
|
413
436
|
parent?.mini?.removeAttribute("collapsed");
|
|
414
437
|
}
|
package/src/utils/semantics.js
CHANGED
|
@@ -79,7 +79,7 @@ const KNOWN_PREFIXES = {
|
|
|
79
79
|
* @private
|
|
80
80
|
*/
|
|
81
81
|
export function decodeBasicTag(tag) {
|
|
82
|
-
const firstEqual = (tag || "").
|
|
82
|
+
const firstEqual = (tag || "").lastIndexOf("=");
|
|
83
83
|
if(firstEqual < 0) { return null; }
|
|
84
84
|
return {
|
|
85
85
|
key: decodeKey(tag.substring(0, firstEqual)),
|
|
@@ -99,6 +99,7 @@ export function decodeKey(key = "") {
|
|
|
99
99
|
|
|
100
100
|
const [, prefix, subkey, qualifies ] = match;
|
|
101
101
|
return {
|
|
102
|
+
key: key,
|
|
102
103
|
prefix: prefix || "",
|
|
103
104
|
subkey,
|
|
104
105
|
qualifies: decodeBasicTag(qualifies),
|
|
@@ -106,6 +107,57 @@ export function decodeKey(key = "") {
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Transforms a string containing a list of tags in a ready-to-use parsed object list.
|
|
112
|
+
* @param {string} str The string to read (each tag separated by newline `\n`)
|
|
113
|
+
* @returns {object[]} List of API-formatted tags
|
|
114
|
+
*/
|
|
115
|
+
export function parseSemanticsString(str) {
|
|
116
|
+
const parsedTags = str.split("\n").map(t => {
|
|
117
|
+
const parts = decodeBasicTag(t);
|
|
118
|
+
if(
|
|
119
|
+
parts
|
|
120
|
+
&& parts.key.key.length <= 256
|
|
121
|
+
&& parts.value.length <= 2048
|
|
122
|
+
) {
|
|
123
|
+
return { key: parts.key.key, value: parts.value };
|
|
124
|
+
} else { return null; }
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
if(parsedTags.findIndex(v => !v) >= 0) {
|
|
128
|
+
if(str.trim().length === 0 && parsedTags.length === 1) { return []; }
|
|
129
|
+
throw new Error("Invalid tags");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return parsedTags;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Computes the difference between two set of API tags.
|
|
138
|
+
* API expects a delta between old & new, so result contains only
|
|
139
|
+
* added and deleted tags.
|
|
140
|
+
* @param {object[]} prev The previous set of tags
|
|
141
|
+
* @param {object[]} next The new set of tags
|
|
142
|
+
* @returns {object[]} The new set of tags, with only added/deleted tags
|
|
143
|
+
*/
|
|
144
|
+
export function computeDiffTags(prev = [], next = []) {
|
|
145
|
+
const res = [];
|
|
146
|
+
|
|
147
|
+
// Look for new values
|
|
148
|
+
(next || [])
|
|
149
|
+
.filter(nt => prev.find(pt => pt.key == nt.key && pt.value == nt.value) === undefined)
|
|
150
|
+
.forEach(t => res.push({key: t.key, value: t.value, action: "add"}));
|
|
151
|
+
|
|
152
|
+
// Look for prev values missing in next
|
|
153
|
+
(prev || [])
|
|
154
|
+
.filter(pt => next.find(nt => pt.key == nt.key && pt.value == nt.value) === undefined)
|
|
155
|
+
.forEach(t => res.push({key: t.key, value: t.value, action: "delete"}));
|
|
156
|
+
|
|
157
|
+
return res;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
109
161
|
/**
|
|
110
162
|
* Transforms raw API semantics properties into ready-to-display container.
|
|
111
163
|
* @param {object[]} tags The API semantics tags
|
package/src/utils/services.js
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Panoramax website URL
|
|
9
|
+
* @returns {string} The website URL
|
|
10
|
+
*/
|
|
11
|
+
export function PanoramaxWebsiteURL() {
|
|
12
|
+
return "https://panoramax.fr";
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
/**
|
|
8
16
|
* Panoramax Presets URL
|
|
9
17
|
* @returns {string} The presets URL
|
|
@@ -12,6 +20,14 @@ export function PanoramaxPresetsURL() {
|
|
|
12
20
|
return "https://presets.panoramax.fr";
|
|
13
21
|
}
|
|
14
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Panoramax meta-catalog URL
|
|
25
|
+
* @returns {string} The metacatalog URL
|
|
26
|
+
*/
|
|
27
|
+
export function PanoramaxMetaCatalogURL() {
|
|
28
|
+
return "https://explore.panoramax.fr";
|
|
29
|
+
}
|
|
30
|
+
|
|
15
31
|
/**
|
|
16
32
|
* Temaki icons URL
|
|
17
33
|
* @param {string} [iconName] The icon name to insert in URL
|
package/src/utils/widgets.js
CHANGED
|
@@ -70,3 +70,41 @@ export function listenForMenuClosure(me, callback) {
|
|
|
70
70
|
me._parent.legend?.addEventListener("click", () => callback());
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/** @private */
|
|
75
|
+
function lookForParent(comp) {
|
|
76
|
+
if(comp._parent) {
|
|
77
|
+
return comp._parent;
|
|
78
|
+
}
|
|
79
|
+
else if(comp === document.body) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
else if(comp.parentNode) {
|
|
83
|
+
return lookForParent(comp.parentNode);
|
|
84
|
+
}
|
|
85
|
+
else if(comp.host) {
|
|
86
|
+
return lookForParent(comp.host);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Wait for parent availability
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
export function onceParentAvailable(comp) {
|
|
95
|
+
if(comp._parent) {
|
|
96
|
+
return Promise.resolve(comp._parent);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return new Promise(resolve => {
|
|
100
|
+
const itv = setInterval(() => {
|
|
101
|
+
const p = lookForParent(comp);
|
|
102
|
+
if(p) {
|
|
103
|
+
comp._parent = p;
|
|
104
|
+
clearInterval(itv);
|
|
105
|
+
resolve(comp._parent);
|
|
106
|
+
}
|
|
107
|
+
}, 100);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -15,6 +15,6 @@ describe("getClassName", () => {
|
|
|
15
15
|
|
|
16
16
|
describe("getSubComponentsNames", () => {
|
|
17
17
|
it("works", () => {
|
|
18
|
-
expect(comp.getSubComponentsNames()).toEqual(["loader", "api", "map", "psv"]);
|
|
18
|
+
expect(comp.getSubComponentsNames()).toEqual(["loader", "api", "map", "psv", "grid"]);
|
|
19
19
|
});
|
|
20
20
|
});
|
|
@@ -10,6 +10,13 @@ exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
|
10
10
|
slot="top"
|
|
11
11
|
/>,
|
|
12
12
|
],
|
|
13
|
+
Array [
|
|
14
|
+
<pnx-annotations-switch
|
|
15
|
+
class="pnx-only-psv pnx-print-hidden"
|
|
16
|
+
size="xl"
|
|
17
|
+
slot="top"
|
|
18
|
+
/>,
|
|
19
|
+
],
|
|
13
20
|
Array [
|
|
14
21
|
<pnx-widget-zoom
|
|
15
22
|
class="pnx-print-hidden"
|
|
@@ -23,12 +30,6 @@ exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
|
23
30
|
slot="top-left"
|
|
24
31
|
/>,
|
|
25
32
|
],
|
|
26
|
-
Array [
|
|
27
|
-
<pnx-hashtags
|
|
28
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
29
|
-
slot="top-right"
|
|
30
|
-
/>,
|
|
31
|
-
],
|
|
32
33
|
],
|
|
33
34
|
"results": Array [
|
|
34
35
|
Object {
|
|
@@ -61,6 +62,13 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
61
62
|
slot="top"
|
|
62
63
|
/>,
|
|
63
64
|
],
|
|
65
|
+
Array [
|
|
66
|
+
<pnx-annotations-switch
|
|
67
|
+
class="pnx-only-psv pnx-print-hidden"
|
|
68
|
+
size="xl"
|
|
69
|
+
slot="top"
|
|
70
|
+
/>,
|
|
71
|
+
],
|
|
64
72
|
Array [
|
|
65
73
|
<pnx-bottom-drawer
|
|
66
74
|
slot="bottom"
|
|
@@ -78,6 +86,10 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
78
86
|
"type": "return",
|
|
79
87
|
"value": undefined,
|
|
80
88
|
},
|
|
89
|
+
Object {
|
|
90
|
+
"type": "return",
|
|
91
|
+
"value": undefined,
|
|
92
|
+
},
|
|
81
93
|
],
|
|
82
94
|
}
|
|
83
95
|
`;
|
|
@@ -17,13 +17,14 @@ exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
|
17
17
|
/>,
|
|
18
18
|
],
|
|
19
19
|
Array [
|
|
20
|
-
<pnx-
|
|
20
|
+
<pnx-widget-player
|
|
21
21
|
class="pnx-only-psv pnx-print-hidden"
|
|
22
|
-
|
|
22
|
+
size="xl"
|
|
23
|
+
slot="top"
|
|
23
24
|
/>,
|
|
24
25
|
],
|
|
25
26
|
Array [
|
|
26
|
-
<pnx-
|
|
27
|
+
<pnx-annotations-switch
|
|
27
28
|
class="pnx-only-psv pnx-print-hidden"
|
|
28
29
|
size="xl"
|
|
29
30
|
slot="top"
|
|
@@ -105,6 +106,13 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
105
106
|
slot="top"
|
|
106
107
|
/>,
|
|
107
108
|
],
|
|
109
|
+
Array [
|
|
110
|
+
<pnx-annotations-switch
|
|
111
|
+
class="pnx-only-psv pnx-print-hidden"
|
|
112
|
+
size="xl"
|
|
113
|
+
slot="top"
|
|
114
|
+
/>,
|
|
115
|
+
],
|
|
108
116
|
Array [
|
|
109
117
|
<pnx-widget-geosearch
|
|
110
118
|
class="pnx-only-map pnx-print-hidden"
|
|
@@ -150,6 +158,10 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
150
158
|
"type": "return",
|
|
151
159
|
"value": undefined,
|
|
152
160
|
},
|
|
161
|
+
Object {
|
|
162
|
+
"type": "return",
|
|
163
|
+
"value": undefined,
|
|
164
|
+
},
|
|
153
165
|
],
|
|
154
166
|
}
|
|
155
167
|
`;
|
|
@@ -736,5 +736,169 @@ Array [
|
|
|
736
736
|
"visibility",
|
|
737
737
|
"none",
|
|
738
738
|
],
|
|
739
|
+
Array [
|
|
740
|
+
"geovisio_blabla_pictures",
|
|
741
|
+
"circle-sort-key",
|
|
742
|
+
Array [
|
|
743
|
+
"case",
|
|
744
|
+
Array [
|
|
745
|
+
"==",
|
|
746
|
+
Array [
|
|
747
|
+
"get",
|
|
748
|
+
"hidden",
|
|
749
|
+
],
|
|
750
|
+
true,
|
|
751
|
+
],
|
|
752
|
+
90,
|
|
753
|
+
10,
|
|
754
|
+
],
|
|
755
|
+
],
|
|
756
|
+
Array [
|
|
757
|
+
"geovisio_pictures",
|
|
758
|
+
"circle-sort-key",
|
|
759
|
+
Array [
|
|
760
|
+
"case",
|
|
761
|
+
Array [
|
|
762
|
+
"==",
|
|
763
|
+
Array [
|
|
764
|
+
"get",
|
|
765
|
+
"hidden",
|
|
766
|
+
],
|
|
767
|
+
true,
|
|
768
|
+
],
|
|
769
|
+
90,
|
|
770
|
+
10,
|
|
771
|
+
],
|
|
772
|
+
],
|
|
773
|
+
Array [
|
|
774
|
+
"geovisio_blabla_pictures_symbols",
|
|
775
|
+
"icon-image",
|
|
776
|
+
Array [
|
|
777
|
+
"case",
|
|
778
|
+
Array [
|
|
779
|
+
"==",
|
|
780
|
+
Array [
|
|
781
|
+
"get",
|
|
782
|
+
"id",
|
|
783
|
+
],
|
|
784
|
+
undefined,
|
|
785
|
+
],
|
|
786
|
+
"",
|
|
787
|
+
Array [
|
|
788
|
+
"==",
|
|
789
|
+
Array [
|
|
790
|
+
"get",
|
|
791
|
+
"type",
|
|
792
|
+
],
|
|
793
|
+
"equirectangular",
|
|
794
|
+
],
|
|
795
|
+
"pnx-arrow-360",
|
|
796
|
+
"pnx-arrow-flat",
|
|
797
|
+
],
|
|
798
|
+
],
|
|
799
|
+
Array [
|
|
800
|
+
"geovisio_blabla_pictures_symbols",
|
|
801
|
+
"symbol-sort-key",
|
|
802
|
+
Array [
|
|
803
|
+
"case",
|
|
804
|
+
Array [
|
|
805
|
+
"==",
|
|
806
|
+
Array [
|
|
807
|
+
"get",
|
|
808
|
+
"hidden",
|
|
809
|
+
],
|
|
810
|
+
true,
|
|
811
|
+
],
|
|
812
|
+
90,
|
|
813
|
+
10,
|
|
814
|
+
],
|
|
815
|
+
],
|
|
816
|
+
Array [
|
|
817
|
+
"geovisio_pictures_symbols",
|
|
818
|
+
"icon-image",
|
|
819
|
+
Array [
|
|
820
|
+
"case",
|
|
821
|
+
Array [
|
|
822
|
+
"==",
|
|
823
|
+
Array [
|
|
824
|
+
"get",
|
|
825
|
+
"id",
|
|
826
|
+
],
|
|
827
|
+
undefined,
|
|
828
|
+
],
|
|
829
|
+
"",
|
|
830
|
+
Array [
|
|
831
|
+
"==",
|
|
832
|
+
Array [
|
|
833
|
+
"get",
|
|
834
|
+
"type",
|
|
835
|
+
],
|
|
836
|
+
"equirectangular",
|
|
837
|
+
],
|
|
838
|
+
"pnx-arrow-360",
|
|
839
|
+
"pnx-arrow-flat",
|
|
840
|
+
],
|
|
841
|
+
],
|
|
842
|
+
Array [
|
|
843
|
+
"geovisio_pictures_symbols",
|
|
844
|
+
"symbol-sort-key",
|
|
845
|
+
Array [
|
|
846
|
+
"case",
|
|
847
|
+
Array [
|
|
848
|
+
"==",
|
|
849
|
+
Array [
|
|
850
|
+
"get",
|
|
851
|
+
"hidden",
|
|
852
|
+
],
|
|
853
|
+
true,
|
|
854
|
+
],
|
|
855
|
+
90,
|
|
856
|
+
10,
|
|
857
|
+
],
|
|
858
|
+
],
|
|
859
|
+
Array [
|
|
860
|
+
"geovisio_blabla_sequences",
|
|
861
|
+
"line-sort-key",
|
|
862
|
+
Array [
|
|
863
|
+
"case",
|
|
864
|
+
Array [
|
|
865
|
+
"==",
|
|
866
|
+
Array [
|
|
867
|
+
"get",
|
|
868
|
+
"hidden",
|
|
869
|
+
],
|
|
870
|
+
true,
|
|
871
|
+
],
|
|
872
|
+
90,
|
|
873
|
+
10,
|
|
874
|
+
],
|
|
875
|
+
],
|
|
876
|
+
Array [
|
|
877
|
+
"geovisio_blabla_sequences",
|
|
878
|
+
"line-cap",
|
|
879
|
+
"square",
|
|
880
|
+
],
|
|
881
|
+
Array [
|
|
882
|
+
"geovisio_sequences",
|
|
883
|
+
"line-sort-key",
|
|
884
|
+
Array [
|
|
885
|
+
"case",
|
|
886
|
+
Array [
|
|
887
|
+
"==",
|
|
888
|
+
Array [
|
|
889
|
+
"get",
|
|
890
|
+
"hidden",
|
|
891
|
+
],
|
|
892
|
+
true,
|
|
893
|
+
],
|
|
894
|
+
90,
|
|
895
|
+
10,
|
|
896
|
+
],
|
|
897
|
+
],
|
|
898
|
+
Array [
|
|
899
|
+
"geovisio_sequences",
|
|
900
|
+
"line-cap",
|
|
901
|
+
"square",
|
|
902
|
+
],
|
|
739
903
|
]
|
|
740
904
|
`;
|