@panoramax/web-viewer 4.0.2-develop-9b499e28 → 4.0.2-develop-e389d775

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/index.css +1 -1
  3. package/build/index.css.map +1 -1
  4. package/build/index.js +274 -59
  5. package/build/index.js.map +1 -1
  6. package/config/jest/mocks.js +5 -0
  7. package/docs/reference/components/core/PhotoViewer.md +1 -0
  8. package/docs/reference/components/core/Viewer.md +1 -0
  9. package/docs/reference/components/menus/AnnotationsList.md +16 -0
  10. package/docs/reference/components/ui/HashTags.md +15 -0
  11. package/docs/reference/components/ui/ListItem.md +38 -0
  12. package/docs/reference/components/ui/Photo.md +53 -1
  13. package/docs/reference/components/ui/SemanticsTable.md +32 -0
  14. package/docs/reference/utils/PresetsManager.md +35 -0
  15. package/docs/reference.md +4 -0
  16. package/mkdocs.yml +4 -0
  17. package/package.json +2 -1
  18. package/src/components/core/Basic.css +2 -0
  19. package/src/components/core/PhotoViewer.js +11 -0
  20. package/src/components/core/Viewer.js +7 -0
  21. package/src/components/layout/Tabs.js +1 -1
  22. package/src/components/menus/AnnotationsList.js +146 -0
  23. package/src/components/menus/PictureLegend.js +2 -4
  24. package/src/components/menus/PictureMetadata.js +66 -2
  25. package/src/components/menus/index.js +1 -0
  26. package/src/components/styles.js +34 -0
  27. package/src/components/ui/HashTags.js +98 -0
  28. package/src/components/ui/ListItem.js +83 -0
  29. package/src/components/ui/Photo.js +137 -0
  30. package/src/components/ui/SemanticsTable.js +87 -0
  31. package/src/components/ui/index.js +3 -0
  32. package/src/img/osm.svg +49 -0
  33. package/src/img/wd.svg +1 -0
  34. package/src/translations/en.json +22 -0
  35. package/src/translations/fr.json +20 -0
  36. package/src/utils/PresetsManager.js +137 -0
  37. package/src/utils/index.js +3 -1
  38. package/src/utils/picture.js +28 -0
  39. package/src/utils/semantics.js +162 -0
  40. package/src/utils/services.js +38 -0
  41. package/src/utils/widgets.js +18 -1
  42. package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +10 -0
  43. package/tests/components/core/__snapshots__/Viewer.test.js.snap +10 -0
  44. package/tests/utils/PresetsManager.test.js +123 -0
  45. package/tests/utils/semantics.test.js +125 -0
@@ -197,6 +197,11 @@ jest.mock("@photo-sphere-viewer/virtual-tour-plugin", () => ({
197
197
  }));
198
198
 
199
199
 
200
+ jest.mock("@photo-sphere-viewer/markers-plugin", () => ({
201
+ MarkersPlugin: jest.fn(),
202
+ }));
203
+
204
+
200
205
  jest.mock("query-selector-shadow-dom", () => ({
201
206
  querySelectorDeep: jest.fn(),
202
207
  }));
@@ -22,6 +22,7 @@
22
22
  | grid | [<code>CorneredGrid</code>](../layout/CorneredGrid.md/#Panoramax.components.layout.CorneredGrid) | The grid layout manager |
23
23
  | popup | [<code>Popup</code>](../ui/Popup.md/#Panoramax.components.ui.Popup) | The popup container |
24
24
  | urlHandler | [<code>URLHandler</code>](../../utils/URLHandler.md/#Panoramax.utils.URLHandler) | The URL query parameters manager |
25
+ | presetsManager | [<code>PresetsManager</code>](../../utils/PresetsManager.md/#Panoramax.utils.PresetsManager) | The semantics presets manager |
25
26
 
26
27
 
27
28
  * [.PhotoViewer](#Panoramax.components.core.PhotoViewer) ⇐ [<code>Basic</code>](Basic.md/#Panoramax.components.core.Basic)
@@ -24,6 +24,7 @@
24
24
  | mini | [<code>Mini</code>](../layout/Mini.md/#Panoramax.components.layout.Mini) | The reduced/collapsed map/photo component |
25
25
  | popup | [<code>Popup</code>](../ui/Popup.md/#Panoramax.components.ui.Popup) | The popup container |
26
26
  | urlHandler | [<code>URLHandler</code>](../../utils/URLHandler.md/#Panoramax.utils.URLHandler) | The URL query parameters manager |
27
+ | presetsManager | [<code>PresetsManager</code>](../../utils/PresetsManager.md/#Panoramax.utils.PresetsManager) | The semantics presets manager |
27
28
 
28
29
 
29
30
  * [.Viewer](#Panoramax.components.core.Viewer) ⇐ [<code>PhotoViewer</code>](PhotoViewer.md/#Panoramax.components.core.PhotoViewer)
@@ -0,0 +1,16 @@
1
+ <a name="Panoramax.components.menus.AnnotationsList"></a>
2
+
3
+ ## Panoramax.components.menus.AnnotationsList ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
4
+ **Kind**: static class of <code>Panoramax.components.menus</code>
5
+ **Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
6
+ **Element**: pnx-annotations-list
7
+ <a name="new_Panoramax.components.menus.AnnotationsList_new"></a>
8
+
9
+ ### new AnnotationsList()
10
+ Annotations list shows listing of tagged picture areas.
11
+ It uses the parent component currently selected picture.
12
+
13
+ **Example**
14
+ ```html
15
+ <pnx-annotations-list _parent=${viewer} />
16
+ ```
@@ -0,0 +1,15 @@
1
+ <a name="Panoramax.components.ui.HashTags"></a>
2
+
3
+ ## Panoramax.components.ui.HashTags ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
4
+ **Kind**: static class of <code>Panoramax.components.ui</code>
5
+ **Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
6
+ **Element**: pnx-hashtags
7
+ <a name="new_Panoramax.components.ui.HashTags_new"></a>
8
+
9
+ ### new HashTags()
10
+ HashTags component shows the list of hashtags associated to a picture.
11
+
12
+ **Example**
13
+ ```html
14
+ <pnx-hashtags ._parent=${viewer} />
15
+ ```
@@ -0,0 +1,38 @@
1
+ <a name="Panoramax.components.ui.ListItem"></a>
2
+
3
+ ## Panoramax.components.ui.ListItem ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
4
+ **Kind**: static class of <code>Panoramax.components.ui</code>
5
+ **Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
6
+ **Element**: pnx-list-item
7
+ **Slot**: `icon` The left icon (symbol for this item)
8
+ **Slot**: `action` The right icon (symbol for an interactive action)
9
+
10
+ * [.ListItem](#Panoramax.components.ui.ListItem) ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
11
+ * [new ListItem()](#new_Panoramax.components.ui.ListItem_new)
12
+ * [.properties](#Panoramax.components.ui.ListItem+properties) : <code>Object</code>
13
+
14
+ <a name="new_Panoramax.components.ui.ListItem_new"></a>
15
+
16
+ ### new ListItem()
17
+ ListItem is a list entry, in a Material Design fashion.
18
+
19
+ **Example**
20
+ ```html
21
+ <pnx-list-item title="My feature" subtitle="It is very cool">
22
+ <img src="..." slot="icon" />
23
+ <img src="..." slot="action" />
24
+ </pnx-list-item>
25
+ ```
26
+ <a name="Panoramax.components.ui.ListItem+properties"></a>
27
+
28
+ ### listItem.properties : <code>Object</code>
29
+ Component properties.
30
+
31
+ **Kind**: instance property of [<code>ListItem</code>](#Panoramax.components.ui.ListItem)
32
+ **Properties**
33
+
34
+ | Name | Type | Description |
35
+ | --- | --- | --- |
36
+ | title | <code>string</code> | The item title |
37
+ | [subtitle] | <code>string</code> | The item subtitle |
38
+
@@ -3,7 +3,7 @@
3
3
  ## Panoramax.components.ui.Photo ⇐ <code>[photo-sphere-viewer.core.Viewer](https://photo-sphere-viewer.js.org/api/classes/Core.Viewer.html)</code>
4
4
  **Kind**: static class of <code>Panoramax.components.ui</code>
5
5
  **Extends**: <code>[photo-sphere-viewer.core.Viewer](https://photo-sphere-viewer.js.org/api/classes/Core.Viewer.html)</code>
6
- **Emits**: [<code>picture-loading</code>](#Panoramax.components.ui.Photo+event_picture-loading), [<code>picture-preview-started</code>](#Panoramax.components.ui.Photo+event_picture-preview-started), [<code>picture-preview-stopped</code>](#Panoramax.components.ui.Photo+event_picture-preview-stopped), [<code>view-rotated</code>](#Panoramax.components.ui.Photo+event_view-rotated), [<code>picture-loaded</code>](#Panoramax.components.ui.Photo+event_picture-loaded), [<code>picture-tiles-loaded</code>](#Panoramax.components.ui.Photo+event_picture-tiles-loaded), [<code>transition-duration-changed</code>](#Panoramax.components.ui.Photo+event_transition-duration-changed), [<code>sequence-playing</code>](#Panoramax.components.ui.Photo+event_sequence-playing), [<code>sequence-stopped</code>](#Panoramax.components.ui.Photo+event_sequence-stopped), [<code>pictures-navigation-changed</code>](#Panoramax.components.ui.Photo+event_pictures-navigation-changed), [<code>ready</code>](#Panoramax.components.ui.Photo+event_ready)
6
+ **Emits**: [<code>picture-loading</code>](#Panoramax.components.ui.Photo+event_picture-loading), [<code>picture-preview-started</code>](#Panoramax.components.ui.Photo+event_picture-preview-started), [<code>picture-preview-stopped</code>](#Panoramax.components.ui.Photo+event_picture-preview-stopped), [<code>view-rotated</code>](#Panoramax.components.ui.Photo+event_view-rotated), [<code>picture-loaded</code>](#Panoramax.components.ui.Photo+event_picture-loaded), [<code>picture-tiles-loaded</code>](#Panoramax.components.ui.Photo+event_picture-tiles-loaded), [<code>transition-duration-changed</code>](#Panoramax.components.ui.Photo+event_transition-duration-changed), [<code>sequence-playing</code>](#Panoramax.components.ui.Photo+event_sequence-playing), [<code>sequence-stopped</code>](#Panoramax.components.ui.Photo+event_sequence-stopped), [<code>pictures-navigation-changed</code>](#Panoramax.components.ui.Photo+event_pictures-navigation-changed), [<code>ready</code>](#Panoramax.components.ui.Photo+event_ready), [<code>annotations-toggled</code>](#Panoramax.components.ui.Photo+event_annotations-toggled)
7
7
 
8
8
  * [.Photo](#Panoramax.components.ui.Photo) ⇐ <code>[photo-sphere-viewer.core.Viewer](https://photo-sphere-viewer.js.org/api/classes/Core.Viewer.html)</code>
9
9
  * [new Photo(parent, container, [options])](#new_Panoramax.components.ui.Photo_new)
@@ -28,6 +28,10 @@
28
28
  * [.toggleSequencePlaying()](#Panoramax.components.ui.Photo+toggleSequencePlaying)
29
29
  * [.getPicturesNavigation()](#Panoramax.components.ui.Photo+getPicturesNavigation) ⇒ <code>string</code>
30
30
  * [.setPicturesNavigation(pn)](#Panoramax.components.ui.Photo+setPicturesNavigation)
31
+ * [.areAnnotationsVisible()](#Panoramax.components.ui.Photo+areAnnotationsVisible) ⇒ <code>boolean</code>
32
+ * [.toggleAllAnnotations(visible)](#Panoramax.components.ui.Photo+toggleAllAnnotations)
33
+ * [.focusOnAnnotation(id)](#Panoramax.components.ui.Photo+focusOnAnnotation)
34
+ * [.unfocusAnnotation()](#Panoramax.components.ui.Photo+unfocusAnnotation)
31
35
  * [.forceRefresh()](#Panoramax.components.ui.Photo+forceRefresh)
32
36
  * ["ready"](#Panoramax.components.ui.Photo+event_ready)
33
37
  * ["picture-loading"](#Panoramax.components.ui.Photo+event_picture-loading)
@@ -40,6 +44,7 @@
40
44
  * ["sequence-playing"](#Panoramax.components.ui.Photo+event_sequence-playing)
41
45
  * ["sequence-stopped"](#Panoramax.components.ui.Photo+event_sequence-stopped)
42
46
  * ["pictures-navigation-changed"](#Panoramax.components.ui.Photo+event_pictures-navigation-changed)
47
+ * ["annotations-toggled"](#Panoramax.components.ui.Photo+event_annotations-toggled)
43
48
 
44
49
  <a name="new_Panoramax.components.ui.Photo_new"></a>
45
50
 
@@ -246,6 +251,41 @@ Switch the allowed navigation between pictures.
246
251
  | --- | --- | --- |
247
252
  | pn | <code>string</code> | The picture navigation mode ("any": no restriction, "seq": only pictures in same sequence, "pic": only selected picture) |
248
253
 
254
+ <a name="Panoramax.components.ui.Photo+areAnnotationsVisible"></a>
255
+
256
+ ### photo.areAnnotationsVisible() ⇒ <code>boolean</code>
257
+ Are there any picture annotations shown ?
258
+
259
+ **Kind**: instance method of [<code>Photo</code>](#Panoramax.components.ui.Photo)
260
+ **Returns**: <code>boolean</code> - True if annotations are visible
261
+ <a name="Panoramax.components.ui.Photo+toggleAllAnnotations"></a>
262
+
263
+ ### photo.toggleAllAnnotations(visible)
264
+ Toggle visibility of picture annotations
265
+
266
+ **Kind**: instance method of [<code>Photo</code>](#Panoramax.components.ui.Photo)
267
+
268
+ | Param | Type | Description |
269
+ | --- | --- | --- |
270
+ | visible | <code>boolean</code> | True to make visible, false to hide |
271
+
272
+ <a name="Panoramax.components.ui.Photo+focusOnAnnotation"></a>
273
+
274
+ ### photo.focusOnAnnotation(id)
275
+ Make view centered and zoomed on given annotation.
276
+
277
+ **Kind**: instance method of [<code>Photo</code>](#Panoramax.components.ui.Photo)
278
+
279
+ | Param | Type | Description |
280
+ | --- | --- | --- |
281
+ | id | <code>string</code> | The annotation UUID |
282
+
283
+ <a name="Panoramax.components.ui.Photo+unfocusAnnotation"></a>
284
+
285
+ ### photo.unfocusAnnotation()
286
+ Remove focus styling on annotations.
287
+
288
+ **Kind**: instance method of [<code>Photo</code>](#Panoramax.components.ui.Photo)
249
289
  <a name="Panoramax.components.ui.Photo+forceRefresh"></a>
250
290
 
251
291
  ### photo.forceRefresh()
@@ -383,3 +423,15 @@ Event for pictures navigation mode change
383
423
  | --- | --- | --- |
384
424
  | detail.value | <code>string</code> | New mode (any, pic, seq) |
385
425
 
426
+ <a name="Panoramax.components.ui.Photo+event_annotations-toggled"></a>
427
+
428
+ ### "annotations-toggled"
429
+ Event for pictures annotation visibility change
430
+
431
+ **Kind**: event emitted by [<code>Photo</code>](#Panoramax.components.ui.Photo)
432
+ **Properties**
433
+
434
+ | Name | Type | Description |
435
+ | --- | --- | --- |
436
+ | detail.visible | <code>boolean</code> | True if they are visible |
437
+
@@ -0,0 +1,32 @@
1
+ <a name="Panoramax.components.ui.SemanticsTable"></a>
2
+
3
+ ## Panoramax.components.ui.SemanticsTable ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
4
+ **Kind**: static class of <code>Panoramax.components.ui</code>
5
+ **Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
6
+ **Element**: pnx-semantics-table
7
+
8
+ * [.SemanticsTable](#Panoramax.components.ui.SemanticsTable) ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
9
+ * [new SemanticsTable()](#new_Panoramax.components.ui.SemanticsTable_new)
10
+ * [.properties](#Panoramax.components.ui.SemanticsTable+properties) : <code>Object</code>
11
+
12
+ <a name="new_Panoramax.components.ui.SemanticsTable_new"></a>
13
+
14
+ ### new SemanticsTable()
15
+ Semantics Tables display all semantics tags from either a picture or an annotation.
16
+
17
+ **Example**
18
+ ```html
19
+ <pnx-semantics-table source=${picture.properties} ._t=${viewer._t} />
20
+ ```
21
+ <a name="Panoramax.components.ui.SemanticsTable+properties"></a>
22
+
23
+ ### semanticsTable.properties : <code>Object</code>
24
+ Component properties.
25
+
26
+ **Kind**: instance property of [<code>SemanticsTable</code>](#Panoramax.components.ui.SemanticsTable)
27
+ **Properties**
28
+
29
+ | Name | Type | Description |
30
+ | --- | --- | --- |
31
+ | [source] | <code>object</code> | The picture or annotation feature (having a `semantics` property) |
32
+
@@ -0,0 +1,35 @@
1
+ <a name="Panoramax.utils.PresetsManager"></a>
2
+
3
+ ## Panoramax.utils.PresetsManager
4
+ **Kind**: static class of <code>Panoramax.utils</code>
5
+
6
+ * [.PresetsManager](#Panoramax.utils.PresetsManager)
7
+ * [new PresetsManager([lang], [skipLoad])](#new_Panoramax.utils.PresetsManager_new)
8
+ * [.onceReady()](#Panoramax.utils.PresetsManager+onceReady) ⇒ <code>Promise</code>
9
+ * [.getPreset()](#Panoramax.utils.PresetsManager+getPreset) ⇒ <code>Promise</code>
10
+
11
+ <a name="new_Panoramax.utils.PresetsManager_new"></a>
12
+
13
+ ### new PresetsManager([lang], [skipLoad])
14
+ Presets Manager handle retrieval of presets against dedicated endpoint.
15
+ It allows an easily search between all presets, and handles translations.
16
+
17
+
18
+ | Param | Type | Default | Description |
19
+ | --- | --- | --- | --- |
20
+ | [lang] | <code>string</code> | | The user prefered language. Defaults to web browser preferences. |
21
+ | [skipLoad] | <code>boolean</code> | <code>false</code> | Set to true to disable automatic load of API data |
22
+
23
+ <a name="Panoramax.utils.PresetsManager+onceReady"></a>
24
+
25
+ ### presetsManager.onceReady() ⇒ <code>Promise</code>
26
+ Resolves when the all necessary data was downloaded.
27
+
28
+ **Kind**: instance method of [<code>PresetsManager</code>](#Panoramax.utils.PresetsManager)
29
+ <a name="Panoramax.utils.PresetsManager+getPreset"></a>
30
+
31
+ ### presetsManager.getPreset() ⇒ <code>Promise</code>
32
+ Find the best matching preset for a given STAC feature.
33
+
34
+ **Kind**: instance method of [<code>PresetsManager</code>](#Panoramax.utils.PresetsManager)
35
+ **Fulfil**: <code>object\|null</code> The preset JSON that best matches, or null if no matches
package/docs/reference.md CHANGED
@@ -25,6 +25,7 @@ Layout helpers:
25
25
 
26
26
  All-in-one, ready-to-use menus for complex operations. Note that they don't embed a container (like popup or panel) to be reusable in any situation.
27
27
 
28
+ - [AnnotationsList](./reference/components/menus/AnnotationsList.md) : selected picture list of annotations (areas with tags).
28
29
  - [MapBackground](./reference/components/menus/MapBackground.md) : change map background.
29
30
  - [MapFilters](./reference/components/menus/MapFilters.md) : set map filters.
30
31
  - [MapLayers](./reference/components/menus/MapLayers.md) : change map theme and background.
@@ -44,8 +45,10 @@ Basic UI components:
44
45
  - [ButtonGroup](./reference/components/ui/ButtonGroup.md) : button bar.
45
46
  - [CopyButton](./reference/components/ui/CopyButton.md) : a copy-to-clipboard button.
46
47
  - [Grade](./reference/components/ui/Grade.md) : a 5-star rating display.
48
+ - [HashTags](./reference/components/ui/HashTags.md) : a list of hashtags associated to a picture.
47
49
  - [LinkButton](./reference/components/ui/LinkButton.md) : a link button.
48
50
  - [ListGroup](./reference/components/ui/ListGroup.md) : a menu-like list of buttons and links.
51
+ - [ListItem](./reference/components/ui/ListItem.md) : a Material Design-like list entry.
49
52
  - [Loader](./reference/components/ui/Loader.md) : the fullscreen initial loader.
50
53
  - [Map](./reference/components/ui/Map.md) : the browseable map (MapLibre GL).
51
54
  - [MapMore](./reference/components/ui/MapMore.md) : advanced version of the browseable map.
@@ -54,6 +57,7 @@ Basic UI components:
54
57
  - [ProgressBar](./reference/components/ui/ProgressBar.md) : a progress bar.
55
58
  - [QualityScore](./reference/components/ui/QualityScore.md) : a A/B/C/D/E grade display and input.
56
59
  - [SearchBar](./reference/components/ui/SearchBar.md) : a search bar.
60
+ - [SemanticsTable](./reference/components/ui/SemanticsTable.md) : table for showing complete semantic tags of a picture/annotation.
57
61
  - [TogglableGroup](./reference/components/ui/TogglableGroup.md) : an helper for showing a menu on button click.
58
62
 
59
63
 
package/mkdocs.yml CHANGED
@@ -65,6 +65,7 @@ nav:
65
65
  - Mini: 'reference/components/layout/Mini.md'
66
66
  - Tabs: 'reference/components/layout/Tabs.md'
67
67
  - menus:
68
+ - AnnotationsList: 'reference/components/menus/AnnotationsList.md'
68
69
  - MapBackground: 'reference/components/menus/MapBackground.md'
69
70
  - MapFilters: 'reference/components/menus/MapFilters.md'
70
71
  - MapLayers: 'reference/components/menus/MapLayers.md'
@@ -90,8 +91,10 @@ nav:
90
91
  - ButtonGroup: 'reference/components/ui/ButtonGroup.md'
91
92
  - CopyButton: 'reference/components/ui/CopyButton.md'
92
93
  - Grade: 'reference/components/ui/Grade.md'
94
+ - HashTags: 'reference/components/ui/HashTags.md'
93
95
  - LinkButton: 'reference/components/ui/LinkButton.md'
94
96
  - ListGroup: 'reference/components/ui/ListGroup.md'
97
+ - ListItem: 'reference/components/ui/ListItem.md'
95
98
  - Loader: 'reference/components/ui/Loader.md'
96
99
  - Map: 'reference/components/ui/Map.md'
97
100
  - MapMore: 'reference/components/ui/MapMore.md'
@@ -100,6 +103,7 @@ nav:
100
103
  - ProgressBar: 'reference/components/ui/ProgressBar.md'
101
104
  - QualityScore: 'reference/components/ui/QualityScore.md'
102
105
  - SearchBar: 'reference/components/ui/SearchBar.md'
106
+ - SemanticsTable: 'reference/components/ui/SemanticsTable.md'
103
107
  - TogglableGroup: 'reference/components/ui/TogglableGroup.md'
104
108
  - utils:
105
109
  - API: 'reference/utils/API.md'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "4.0.2-develop-9b499e28",
3
+ "version": "4.0.2-develop-e389d775",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -98,6 +98,7 @@
98
98
  "@photo-sphere-viewer/gallery-plugin": "5.12.1",
99
99
  "@photo-sphere-viewer/markers-plugin": "5.12.1",
100
100
  "@photo-sphere-viewer/virtual-tour-plugin": "5.12.1",
101
+ "iconify-icon": "^3.0.0",
101
102
  "json5": "^2.2.3",
102
103
  "lit": "^3.2.1",
103
104
  "maplibre-gl": "^5.3.0",
@@ -4,6 +4,7 @@
4
4
  --black: #181818;
5
5
  --black-pale: #1b1a17;
6
6
  --red: #f70000;
7
+ --red-transparent: rgba(247, 0, 0, 0.3);
7
8
  --red-pale: #ff726f;
8
9
  --grey: #f5f5f5;
9
10
  --grey-pale: #cfd2cf;
@@ -17,6 +18,7 @@
17
18
  --beige: #f5f3ec;
18
19
  --yellow: #fec868;
19
20
  --orange: #ff6f00;
21
+ --orange-transparent: rgba(255,111,0,0.3);
20
22
  --orange-pale: #fffafa;
21
23
  --green: #7ec636;
22
24
  --green-pale: #f0ffee;
@@ -9,6 +9,7 @@ import Photo, { PSV_DEFAULT_ZOOM, PSV_ANIM_DURATION } from "../ui/Photo";
9
9
  import { createWebComp } from "../../utils/widgets";
10
10
  import { isNullId } from "../../utils/utils";
11
11
  import { default as InitParameters, alterPSVState, alterMapState, alterPhotoViewerState } from "../../utils/InitParameters";
12
+ import PresetManager from "../../utils/PresetsManager";
12
13
 
13
14
 
14
15
  export const PSV_ZOOM_DELTA = 20;
@@ -32,6 +33,7 @@ const PSV_MOVE_DELTA = Math.PI / 6;
32
33
  * @property {Panoramax.components.layout.CorneredGrid} grid The grid layout manager
33
34
  * @property {Panoramax.components.ui.Popup} popup The popup container
34
35
  * @property {Panoramax.utils.URLHandler} urlHandler The URL query parameters manager
36
+ * @property {Panoramax.utils.PresetsManager} presetsManager The semantics presets manager
35
37
  * @fires Panoramax.components.core.Basic#select
36
38
  * @fires Panoramax.components.core.Basic#ready
37
39
  * @fires Panoramax.components.core.Basic#broken
@@ -133,12 +135,19 @@ export default class PhotoViewer extends Basic {
133
135
  focus: this._initParams.getParentPostInit().focus,
134
136
  picture: this._initParams.getParentPostInit().picture,
135
137
  });
138
+
136
139
  this.grid.appendChild(createWebComp("pnx-widget-zoom", {
137
140
  slot: "bottom-right",
138
141
  class: "pnx-print-hidden",
139
142
  _parent: this
140
143
  }));
141
144
  this.grid.appendChild(this.legend);
145
+
146
+ this.grid.appendChild(createWebComp("pnx-hashtags", {
147
+ slot: "top-right",
148
+ _parent: this,
149
+ class: "pnx-only-psv pnx-print-hidden",
150
+ }));
142
151
  }
143
152
  else {
144
153
  this.legend = createWebComp("pnx-picture-legend", { _parent: this });
@@ -161,6 +170,8 @@ export default class PhotoViewer extends Basic {
161
170
  connectedCallback() {
162
171
  super.connectedCallback();
163
172
 
173
+ this.presetsManager = new PresetManager(this.lang);
174
+
164
175
  if(this["url-parameters"] && this["url-parameters"] !== "false") {
165
176
  this.urlHandler = new URLHandler(this);
166
177
  this.onceReady().then(() => {
@@ -39,6 +39,7 @@ const MAP_MOVE_DELTA = 100;
39
39
  * @property {Panoramax.components.layout.Mini} mini The reduced/collapsed map/photo component
40
40
  * @property {Panoramax.components.ui.Popup} popup The popup container
41
41
  * @property {Panoramax.utils.URLHandler} urlHandler The URL query parameters manager
42
+ * @property {Panoramax.utils.PresetsManager} presetsManager The semantics presets manager
42
43
  * @fires Panoramax.components.core.Basic#select
43
44
  * @fires Panoramax.components.core.Basic#ready
44
45
  * @fires Panoramax.components.core.Basic#broken
@@ -156,6 +157,12 @@ export default class Viewer extends PhotoViewer {
156
157
  picture: this._initParams.getParentPostInit().picture,
157
158
  });
158
159
  this.grid.appendChild(this.legend);
160
+
161
+ this.grid.appendChild(createWebComp("pnx-hashtags", {
162
+ slot: "top-right",
163
+ _parent: this,
164
+ class: "pnx-only-psv pnx-print-hidden",
165
+ }));
159
166
  }
160
167
  else {
161
168
  this.legend = createWebComp("pnx-picture-legend", { _parent: this });
@@ -121,7 +121,7 @@ export default class Tabs extends LitElement {
121
121
  render() {
122
122
  return html`
123
123
  <nav @click="${this._handleTabClick}">
124
- <slot name="title"></slot>
124
+ <slot name="title" @slotchange=${() => this.activeTabIndex = 0}></slot>
125
125
  </nav>
126
126
  <div class="contents">
127
127
  <slot name="content"></slot>
@@ -0,0 +1,146 @@
1
+ import { LitElement, html, css, nothing } from "lit";
2
+ import { faSvg, iconify } from "../styles";
3
+ import { fa, moreIcons } from "../../utils/widgets";
4
+ import { faChevronRight } from "@fortawesome/free-solid-svg-icons/faChevronRight";
5
+ import { faArrowLeft } from "@fortawesome/free-solid-svg-icons/faArrowLeft";
6
+ import "iconify-icon";
7
+
8
+ /**
9
+ * Annotations list shows listing of tagged picture areas.
10
+ * It uses the parent component currently selected picture.
11
+ *
12
+ * @class Panoramax.components.menus.AnnotationsList
13
+ * @element pnx-annotations-list
14
+ * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
15
+ * @example
16
+ * ```html
17
+ * <pnx-annotations-list _parent=${viewer} />
18
+ * ```
19
+ */
20
+ export default class AnnotationsList extends LitElement {
21
+ /** @private */
22
+ static styles = [ faSvg, iconify, css`
23
+ .annotation { background: var(--white); }
24
+ ` ];
25
+
26
+ /** @private */
27
+ static properties = {
28
+ _meta: {state: true},
29
+ _selectedAnnotation: {state: true},
30
+ _presets: {state: true},
31
+ };
32
+
33
+ constructor() {
34
+ super();
35
+ this._selectedAnnotation = null;
36
+ this._presets = {};
37
+ moreIcons();
38
+ }
39
+
40
+ /** @private */
41
+ connectedCallback() {
42
+ super.connectedCallback();
43
+
44
+ this._onPicChange();
45
+ this._parent?.psv?.addEventListener("picture-loaded", this._onPicChange.bind(this));
46
+
47
+ this._parent?.psv?._myMarkers?.addEventListener("select-marker", ({ marker }) => {
48
+ const aPos = this._meta.properties?.annotations?.findIndex(a => a.id === marker.data.id);
49
+ if(aPos >= 0) { this._onListItemClick(Object.assign({nb: aPos+1}, this._meta.properties.annotations[aPos])); }
50
+ });
51
+ }
52
+
53
+ /** @private */
54
+ _onPicChange() {
55
+ this._meta = this._parent?.psv?.getPictureMetadata();
56
+ delete this._prevPsvView;
57
+
58
+ // Load presets for annotations
59
+ if(this._meta && this._parent?.presetsManager) {
60
+ this._presets = {};
61
+ if(this._meta.properties?.annotations?.length > 0) {
62
+ this._meta.properties.annotations.map(a => this._parent.presetsManager.getPreset(a).then(p => {
63
+ this._presets[a.id] = p;
64
+ this.requestUpdate();
65
+ }));
66
+ }
67
+ }
68
+ }
69
+
70
+ /** @private */
71
+ _onListItemHover(a) {
72
+ if(a) {
73
+ // Save position before hover to allow reset after
74
+ if(!this._prevPsvView) { this._prevPsvView = [this._parent.psv.getZoomLevel(), this._parent.psv.getPosition()]; }
75
+
76
+ this._parent.psv.focusOnAnnotation(a.id);
77
+ }
78
+ else {
79
+ this._parent.psv.unfocusAnnotation();
80
+
81
+ // Restore previous PSV position
82
+ if(this._prevPsvView) {
83
+ this._parent.psv.zoom(this._prevPsvView[0]);
84
+ this._parent.psv.rotate(this._prevPsvView[1]);
85
+ delete this._prevPsvView;
86
+ }
87
+ }
88
+ }
89
+
90
+ /** @private */
91
+ _onListItemClick(a) {
92
+ this._selectedAnnotation = a;
93
+ this._onListItemHover(a);
94
+ }
95
+
96
+ /** @private */
97
+ render() {
98
+ /* eslint-disable indent */
99
+ if(!this._meta) { return nothing; }
100
+
101
+ return this._selectedAnnotation === null
102
+ ? html`<div class="list">
103
+ ${this._meta.properties.annotations.map((a,i) => html`
104
+ <pnx-list-item
105
+ title=${
106
+ this._presets[a.id]?.name
107
+ || this._parent?._t.pnx.semantics_features_default_title.replace("{nb}", i+1)
108
+ }
109
+ subtitle=${this._parent?._t.pnx.semantics_features_subtitle.replace("{nb}", a.semantics.length)}
110
+ @click=${() => this._onListItemClick(Object.assign({nb: i+1}, a))}
111
+ @mouseover=${() => this._onListItemHover(Object.assign({nb: i+1}, a))}
112
+ @mouseout=${() => this._onListItemHover(null)}
113
+ >
114
+ <iconify-icon
115
+ slot="icon"
116
+ icon=${this._presets[a.id]?.iconify || "fa6-solid:cube"}
117
+ style="font-size: 1.5em"
118
+ ></iconify-icon>
119
+ ${fa(faChevronRight, {transform: {size: 24}, attributes: {slot: "action"}})}
120
+ </pnx-list-item>
121
+ `)}
122
+ </div>`
123
+ : html`<div class="annotation">
124
+ <pnx-list-item
125
+ title=${
126
+ this._presets[this._selectedAnnotation.id]?.name
127
+ || this._parent?._t.pnx.semantics_features_default_title.replace("{nb}", this._selectedAnnotation.nb)
128
+ }
129
+ @click=${() => this._onListItemClick(null)}
130
+ >
131
+ ${fa(faArrowLeft, {transform: {size: 24}, attributes: {slot: "icon"}})}
132
+ <iconify-icon
133
+ slot="icon"
134
+ icon=${this._presets[this._selectedAnnotation.id]?.iconify || "fa6-solid:cube"}
135
+ style="font-size: 1.5em"
136
+ ></iconify-icon>
137
+ </pnx-list-item>
138
+ <pnx-semantics-table
139
+ ._t=${this._parent?._t}
140
+ .source=${this._selectedAnnotation}
141
+ />
142
+ </div>`;
143
+ }
144
+ }
145
+
146
+ customElements.define("pnx-annotations-list", AnnotationsList);
@@ -8,7 +8,7 @@ import { faUser } from "@fortawesome/free-solid-svg-icons/faUser";
8
8
  import { faCalendarAlt } from "@fortawesome/free-solid-svg-icons/faCalendarAlt";
9
9
  import { faTriangleExclamation } from "@fortawesome/free-solid-svg-icons/faTriangleExclamation";
10
10
  import { faShareNodes } from "@fortawesome/free-solid-svg-icons/faShareNodes";
11
- import { placeholder, panel } from "../styles";
11
+ import { placeholder, panel, hidden } from "../styles";
12
12
  import { reverseGeocodingNominatim } from "../../utils/geocoder";
13
13
 
14
14
  /**
@@ -24,7 +24,7 @@ import { reverseGeocodingNominatim } from "../../utils/geocoder";
24
24
  */
25
25
  export default class PictureLegend extends LitElement {
26
26
  /** @private */
27
- static styles = [placeholder, panel, css`
27
+ static styles = [placeholder, panel, hidden, css`
28
28
  :host {
29
29
  overflow-y: auto;
30
30
  overflow-x: hidden;
@@ -38,8 +38,6 @@ export default class PictureLegend extends LitElement {
38
38
  pnx-picture-metadata { width: 30vw; }
39
39
  }
40
40
 
41
- .pnx-hidden { display: none !important; }
42
-
43
41
  /* Top bar */
44
42
  .headline {
45
43
  display: flex;