@panoramax/web-viewer 3.2.3 → 4.0.0-develop-39167b4d

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 (255) hide show
  1. package/.gitlab-ci.yml +13 -6
  2. package/CHANGELOG.md +53 -1
  3. package/CODE_OF_CONDUCT.md +1 -1
  4. package/README.md +1 -1
  5. package/build/editor.html +10 -1
  6. package/build/index.css +12 -12
  7. package/build/index.css.map +1 -1
  8. package/build/index.html +1 -1
  9. package/build/index.js +2126 -14
  10. package/build/index.js.map +1 -1
  11. package/build/map.html +1 -1
  12. package/build/photo.html +1 -0
  13. package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff +0 -0
  14. package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff2 +0 -0
  15. package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff +0 -0
  16. package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff2 +0 -0
  17. package/build/viewer.html +12 -1
  18. package/build/widgets.html +1 -0
  19. package/config/jest/mocks.js +201 -0
  20. package/config/paths.js +2 -0
  21. package/config/webpack.config.js +52 -0
  22. package/docs/03_URL_settings.md +14 -16
  23. package/docs/05_Compatibility.md +59 -76
  24. package/docs/09_Develop.md +46 -11
  25. package/docs/90_Releases.md +2 -2
  26. package/docs/images/class_diagram.drawio +60 -45
  27. package/docs/images/class_diagram.jpg +0 -0
  28. package/docs/images/screenshot.jpg +0 -0
  29. package/docs/index.md +135 -0
  30. package/docs/reference/components/core/Basic.md +196 -0
  31. package/docs/reference/components/core/CoverageMap.md +210 -0
  32. package/docs/reference/components/core/Editor.md +224 -0
  33. package/docs/reference/components/core/PhotoViewer.md +307 -0
  34. package/docs/reference/components/core/Viewer.md +350 -0
  35. package/docs/reference/components/layout/BottomDrawer.md +35 -0
  36. package/docs/reference/components/layout/CorneredGrid.md +29 -0
  37. package/docs/reference/components/layout/Mini.md +45 -0
  38. package/docs/reference/components/layout/Tabs.md +45 -0
  39. package/docs/reference/components/menus/MapBackground.md +32 -0
  40. package/docs/reference/components/menus/MapFilters.md +15 -0
  41. package/docs/reference/components/menus/MapLayers.md +15 -0
  42. package/docs/reference/components/menus/MapLegend.md +15 -0
  43. package/docs/reference/components/menus/PictureLegend.md +16 -0
  44. package/docs/reference/components/menus/PictureMetadata.md +15 -0
  45. package/docs/reference/components/menus/PlayerOptions.md +15 -0
  46. package/docs/reference/components/menus/QualityScoreDoc.md +15 -0
  47. package/docs/reference/components/menus/ReportForm.md +15 -0
  48. package/docs/reference/components/menus/ShareMenu.md +15 -0
  49. package/docs/reference/components/ui/Button.md +40 -0
  50. package/docs/reference/components/ui/ButtonGroup.md +36 -0
  51. package/docs/reference/components/ui/CopyButton.md +38 -0
  52. package/docs/reference/components/ui/Grade.md +32 -0
  53. package/docs/reference/components/ui/LinkButton.md +45 -0
  54. package/docs/reference/components/ui/ListGroup.md +22 -0
  55. package/docs/reference/components/ui/Loader.md +56 -0
  56. package/docs/reference/components/ui/Map.md +239 -0
  57. package/docs/reference/components/ui/MapMore.md +256 -0
  58. package/docs/reference/components/ui/Photo.md +385 -0
  59. package/docs/reference/components/ui/Popup.md +56 -0
  60. package/docs/reference/components/ui/ProgressBar.md +32 -0
  61. package/docs/reference/components/ui/QualityScore.md +45 -0
  62. package/docs/reference/components/ui/SearchBar.md +63 -0
  63. package/docs/reference/components/ui/TogglableGroup.md +39 -0
  64. package/docs/reference/components/ui/widgets/GeoSearch.md +32 -0
  65. package/docs/reference/components/ui/widgets/Legend.md +49 -0
  66. package/docs/reference/components/ui/widgets/MapFiltersButton.md +33 -0
  67. package/docs/reference/components/ui/widgets/MapLayersButton.md +15 -0
  68. package/docs/reference/components/ui/widgets/OSMEditors.md +15 -0
  69. package/docs/reference/components/ui/widgets/PictureLegendActions.md +32 -0
  70. package/docs/reference/components/ui/widgets/Player.md +33 -0
  71. package/docs/reference/components/ui/widgets/Zoom.md +15 -0
  72. package/docs/reference/utils/API.md +334 -0
  73. package/docs/reference/utils/InitParameters.md +68 -0
  74. package/docs/reference/utils/URLHandler.md +107 -0
  75. package/docs/reference.md +79 -0
  76. package/docs/shortcuts.md +11 -0
  77. package/docs/tutorials/aerial_imagery.md +19 -0
  78. package/docs/tutorials/authentication.md +10 -0
  79. package/docs/tutorials/custom_widgets.md +59 -0
  80. package/docs/tutorials/map_style.md +39 -0
  81. package/docs/tutorials/migrate_v4.md +153 -0
  82. package/docs/tutorials/synced_coverage.md +43 -0
  83. package/mkdocs.yml +66 -5
  84. package/package.json +22 -17
  85. package/public/editor.html +21 -29
  86. package/public/index.html +17 -12
  87. package/public/map.html +19 -18
  88. package/public/photo.html +55 -0
  89. package/public/viewer.html +22 -26
  90. package/public/widgets.html +306 -0
  91. package/scripts/doc.js +79 -0
  92. package/src/components/core/Basic.css +48 -0
  93. package/src/components/core/Basic.js +349 -0
  94. package/src/components/core/CoverageMap.css +9 -0
  95. package/src/components/core/CoverageMap.js +139 -0
  96. package/src/components/core/Editor.css +23 -0
  97. package/src/components/core/Editor.js +390 -0
  98. package/src/components/core/PhotoViewer.css +48 -0
  99. package/src/components/core/PhotoViewer.js +499 -0
  100. package/src/components/core/Viewer.css +98 -0
  101. package/src/components/core/Viewer.js +564 -0
  102. package/src/components/core/index.js +12 -0
  103. package/src/components/index.js +13 -0
  104. package/src/components/layout/BottomDrawer.js +257 -0
  105. package/src/components/layout/CorneredGrid.js +112 -0
  106. package/src/components/layout/Mini.js +117 -0
  107. package/src/components/layout/Tabs.js +133 -0
  108. package/src/components/layout/index.js +9 -0
  109. package/src/components/menus/MapBackground.js +106 -0
  110. package/src/components/menus/MapFilters.js +400 -0
  111. package/src/components/menus/MapLayers.js +143 -0
  112. package/src/components/menus/MapLegend.js +34 -0
  113. package/src/components/menus/PictureLegend.js +257 -0
  114. package/src/components/menus/PictureMetadata.js +317 -0
  115. package/src/components/menus/PlayerOptions.js +95 -0
  116. package/src/components/menus/QualityScoreDoc.js +36 -0
  117. package/src/components/menus/ReportForm.js +133 -0
  118. package/src/components/menus/Share.js +100 -0
  119. package/src/components/menus/index.js +15 -0
  120. package/src/components/styles.js +383 -0
  121. package/src/components/ui/Button.js +77 -0
  122. package/src/components/ui/ButtonGroup.css +57 -0
  123. package/src/components/ui/ButtonGroup.js +68 -0
  124. package/src/components/ui/CopyButton.js +106 -0
  125. package/src/components/ui/Grade.js +54 -0
  126. package/src/components/ui/LinkButton.js +67 -0
  127. package/src/components/ui/ListGroup.js +66 -0
  128. package/src/components/ui/Loader.js +203 -0
  129. package/src/components/{Map.css → ui/Map.css} +5 -17
  130. package/src/components/{Map.js → ui/Map.js} +148 -156
  131. package/src/components/ui/MapMore.js +324 -0
  132. package/src/components/{Photo.css → ui/Photo.css} +6 -6
  133. package/src/components/{Photo.js → ui/Photo.js} +313 -101
  134. package/src/components/ui/Popup.js +145 -0
  135. package/src/components/ui/ProgressBar.js +104 -0
  136. package/src/components/ui/QualityScore.js +147 -0
  137. package/src/components/ui/SearchBar.js +367 -0
  138. package/src/components/ui/TogglableGroup.js +157 -0
  139. package/src/components/ui/index.js +22 -0
  140. package/src/components/ui/widgets/GeoSearch.css +21 -0
  141. package/src/components/ui/widgets/GeoSearch.js +139 -0
  142. package/src/components/ui/widgets/Legend.js +113 -0
  143. package/src/components/ui/widgets/MapFiltersButton.js +104 -0
  144. package/src/components/ui/widgets/MapLayersButton.js +79 -0
  145. package/src/components/ui/widgets/OSMEditors.js +155 -0
  146. package/src/components/ui/widgets/PictureLegendActions.js +117 -0
  147. package/src/components/ui/widgets/Player.css +7 -0
  148. package/src/components/ui/widgets/Player.js +151 -0
  149. package/src/components/ui/widgets/Zoom.js +82 -0
  150. package/src/components/ui/widgets/index.js +13 -0
  151. package/src/img/loader_base.jpg +0 -0
  152. package/src/img/panoramax.svg +13 -0
  153. package/src/img/switch_big.svg +20 -10
  154. package/src/index.js +7 -9
  155. package/src/translations/br.json +1 -0
  156. package/src/translations/da.json +38 -15
  157. package/src/translations/de.json +5 -3
  158. package/src/translations/en.json +35 -15
  159. package/src/translations/eo.json +38 -15
  160. package/src/translations/es.json +1 -1
  161. package/src/translations/fr.json +36 -16
  162. package/src/translations/hu.json +1 -1
  163. package/src/translations/it.json +39 -16
  164. package/src/translations/ja.json +182 -1
  165. package/src/translations/nl.json +106 -6
  166. package/src/translations/pl.json +1 -1
  167. package/src/translations/sv.json +182 -0
  168. package/src/translations/zh_Hant.json +35 -14
  169. package/src/utils/API.js +109 -49
  170. package/src/utils/InitParameters.js +388 -0
  171. package/src/utils/PhotoAdapter.js +1 -0
  172. package/src/utils/URLHandler.js +362 -0
  173. package/src/utils/geocoder.js +152 -0
  174. package/src/utils/{I18n.js → i18n.js} +7 -3
  175. package/src/utils/index.js +11 -0
  176. package/src/utils/{Map.js → map.js} +256 -77
  177. package/src/utils/picture.js +442 -0
  178. package/src/utils/utils.js +324 -0
  179. package/src/utils/widgets.js +55 -0
  180. package/tests/components/core/Basic.test.js +121 -0
  181. package/tests/components/core/BasicMock.js +25 -0
  182. package/tests/components/core/CoverageMap.test.js +20 -0
  183. package/tests/components/core/Editor.test.js +20 -0
  184. package/tests/components/core/PhotoViewer.test.js +57 -0
  185. package/tests/components/core/Viewer.test.js +84 -0
  186. package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +73 -0
  187. package/tests/components/core/__snapshots__/Viewer.test.js.snap +145 -0
  188. package/tests/components/ui/CopyButton.test.js +52 -0
  189. package/tests/components/ui/Loader.test.js +55 -0
  190. package/tests/components/{Map.test.js → ui/Map.test.js} +73 -61
  191. package/tests/components/{Photo.test.js → ui/Photo.test.js} +97 -63
  192. package/tests/components/ui/Popup.test.js +26 -0
  193. package/tests/components/ui/QualityScore.test.js +18 -0
  194. package/tests/components/ui/SearchBar.test.js +110 -0
  195. package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +33 -0
  196. package/tests/components/ui/__snapshots__/Loader.test.js.snap +56 -0
  197. package/tests/components/{__snapshots__ → ui/__snapshots__}/Map.test.js.snap +11 -38
  198. package/tests/components/{__snapshots__ → ui/__snapshots__}/Photo.test.js.snap +70 -6
  199. package/tests/components/ui/__snapshots__/Popup.test.js.snap +29 -0
  200. package/tests/components/ui/__snapshots__/QualityScore.test.js.snap +11 -0
  201. package/tests/components/ui/__snapshots__/SearchBar.test.js.snap +65 -0
  202. package/tests/utils/API.test.js +83 -83
  203. package/tests/utils/InitParameters.test.js +499 -0
  204. package/tests/utils/URLHandler.test.js +401 -0
  205. package/tests/utils/__snapshots__/API.test.js.snap +10 -0
  206. package/tests/utils/__snapshots__/URLHandler.test.js.snap +21 -0
  207. package/tests/utils/__snapshots__/{Map.test.js.snap → geocoder.test.js.snap} +1 -1
  208. package/tests/utils/__snapshots__/map.test.js.snap +11 -0
  209. package/tests/utils/__snapshots__/picture.test.js.snap +327 -0
  210. package/tests/utils/__snapshots__/widgets.test.js.snap +19 -0
  211. package/tests/utils/geocoder.test.js +37 -0
  212. package/tests/utils/{I18n.test.js → i18n.test.js} +8 -8
  213. package/tests/utils/map.test.js +126 -0
  214. package/tests/utils/picture.test.js +745 -0
  215. package/tests/utils/utils.test.js +288 -0
  216. package/tests/utils/widgets.test.js +31 -0
  217. package/docs/01_Start.md +0 -149
  218. package/docs/02_Usage.md +0 -831
  219. package/docs/04_Advanced_examples.md +0 -216
  220. package/src/Editor.css +0 -37
  221. package/src/Editor.js +0 -361
  222. package/src/StandaloneMap.js +0 -114
  223. package/src/Viewer.css +0 -203
  224. package/src/Viewer.js +0 -1246
  225. package/src/components/CoreView.css +0 -70
  226. package/src/components/CoreView.js +0 -175
  227. package/src/components/Loader.css +0 -74
  228. package/src/components/Loader.js +0 -120
  229. package/src/img/loader_hd.jpg +0 -0
  230. package/src/utils/Exif.js +0 -193
  231. package/src/utils/Utils.js +0 -631
  232. package/src/utils/Widgets.js +0 -562
  233. package/src/viewer/URLHash.js +0 -469
  234. package/src/viewer/Widgets.css +0 -880
  235. package/src/viewer/Widgets.js +0 -1470
  236. package/tests/Editor.test.js +0 -126
  237. package/tests/StandaloneMap.test.js +0 -45
  238. package/tests/Viewer.test.js +0 -366
  239. package/tests/__snapshots__/Editor.test.js.snap +0 -298
  240. package/tests/__snapshots__/StandaloneMap.test.js.snap +0 -30
  241. package/tests/__snapshots__/Viewer.test.js.snap +0 -195
  242. package/tests/components/CoreView.test.js +0 -92
  243. package/tests/components/Loader.test.js +0 -38
  244. package/tests/components/__snapshots__/Loader.test.js.snap +0 -15
  245. package/tests/utils/Exif.test.js +0 -124
  246. package/tests/utils/Map.test.js +0 -113
  247. package/tests/utils/Utils.test.js +0 -300
  248. package/tests/utils/Widgets.test.js +0 -107
  249. package/tests/utils/__snapshots__/Exif.test.js.snap +0 -43
  250. package/tests/utils/__snapshots__/Utils.test.js.snap +0 -41
  251. package/tests/utils/__snapshots__/Widgets.test.js.snap +0 -44
  252. package/tests/viewer/URLHash.test.js +0 -559
  253. package/tests/viewer/Widgets.test.js +0 -127
  254. package/tests/viewer/__snapshots__/URLHash.test.js.snap +0 -108
  255. package/tests/viewer/__snapshots__/Widgets.test.js.snap +0 -403
@@ -0,0 +1,106 @@
1
+ import { LitElement, html, css } from "lit";
2
+ import BackgroundAerial from "../../img/bg_aerial.jpg";
3
+ import BackgroundStreets from "../../img/bg_streets.jpg";
4
+
5
+ /**
6
+ * Map Background menu allows user to select background.
7
+ * @class Panoramax.components.menus.MapBackground
8
+ * @element pnx-map-background
9
+ * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
10
+ * @example
11
+ * ```html
12
+ * <pnx-map-background size="sm" _parent=${viewer} />
13
+ * ```
14
+ */
15
+ export default class MapBackground extends LitElement {
16
+ /** @private */
17
+ static styles = [ css`
18
+ :host {
19
+ justify-content: space-evenly;
20
+ box-sizing: border-box;
21
+ display: flex;
22
+ gap: 10px;
23
+ }
24
+ input { display: none; }
25
+ label { cursor: pointer; }
26
+
27
+ img {
28
+ width: 40px;
29
+ border-radius: 5px;
30
+ vertical-align: middle;
31
+ margin-right: 5px;
32
+ border: 2px solid var(--widget-bg);
33
+ }
34
+
35
+ img.sm {
36
+ width: 32px;
37
+ }
38
+
39
+ input:checked + label img {
40
+ outline: 3px solid var(--widget-border-btn);
41
+ }
42
+ ` ];
43
+
44
+ /**
45
+ * Component properties.
46
+ * @memberof Panoramax.components.menus.MapBackground#
47
+ * @type {Object}
48
+ * @property {string} [size=md] The size of the button (sm, md)
49
+ */
50
+ static properties = {
51
+ bg: {state: true},
52
+ size: {type: String},
53
+ };
54
+
55
+ constructor() {
56
+ super();
57
+ this.size = "md";
58
+ }
59
+
60
+ /** @private */
61
+ connectedCallback() {
62
+ super.connectedCallback();
63
+ this._parent?.map?.on("background-changed", e => {
64
+ this.bg = e.background;
65
+ });
66
+ this.bg = this._parent?.map?.getBackground();
67
+ }
68
+
69
+ /** @private */
70
+ _onBgSelect(e) {
71
+ this.bg = e.target.value;
72
+ this._parent?.map?.setBackground(this.bg);
73
+ }
74
+
75
+ /** @private */
76
+ render() {
77
+ return html`
78
+ <input
79
+ type="radio"
80
+ id="bg-streets"
81
+ name="bg"
82
+ value="streets"
83
+ @change=${this._onBgSelect}
84
+ .checked=${this.bg == "streets"}
85
+ />
86
+ <label for="bg-streets">
87
+ <img src=${BackgroundStreets} class=${this.size} alt="" />
88
+ ${this._parent?._t.pnx.map_background_streets}
89
+ </label>
90
+ <input
91
+ type="radio"
92
+ id="bg-aerial"
93
+ name="bg"
94
+ value="aerial"
95
+ @change=${this._onBgSelect}
96
+ .checked=${this.bg == "aerial"}
97
+ />
98
+ <label for="bg-aerial">
99
+ <img src=${BackgroundAerial} class=${this.size} alt="" />
100
+ ${this._parent?._t.pnx.map_background_aerial}
101
+ </label>
102
+ `;
103
+ }
104
+ }
105
+
106
+ customElements.define("pnx-map-background", MapBackground);
@@ -0,0 +1,400 @@
1
+ import { LitElement, html, css, nothing } from "lit";
2
+ import { fa } from "../../utils/widgets";
3
+ import { getUserAccount } from "../../utils/utils";
4
+ import { faSvg, titles } from "../styles";
5
+ import { faImage } from "@fortawesome/free-solid-svg-icons/faImage";
6
+ import { faCalendar } from "@fortawesome/free-solid-svg-icons/faCalendar";
7
+ import { faArrowRight } from "@fortawesome/free-solid-svg-icons/faArrowRight";
8
+ import { faMedal } from "@fortawesome/free-solid-svg-icons/faMedal";
9
+ import { faInfoCircle } from "@fortawesome/free-solid-svg-icons/faInfoCircle";
10
+ import { faUser } from "@fortawesome/free-solid-svg-icons/faUser";
11
+
12
+ /**
13
+ * Map Filters menu allows user to select map data they want displayed.
14
+ * @class Panoramax.components.menus.MapFilters
15
+ * @element pnx-map-filters-menu
16
+ * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
17
+ * @example
18
+ * ```html
19
+ * <pnx-map-filters-menu user-search="" _parent=${viewer} />
20
+ * ```
21
+ */
22
+ export default class MapFilters extends LitElement {
23
+ /** @private */
24
+ static styles = [ faSvg, titles, css`
25
+ .pnx-input-group {
26
+ display: flex;
27
+ flex-direction: row;
28
+ align-items: center;
29
+ justify-content: center;
30
+ gap: 5px;
31
+ }
32
+
33
+ /* Filter block */
34
+ .pnx-filter-block {
35
+ position: relative;
36
+ padding: 10px 15px;
37
+ border-bottom: 2px solid var(--widget-border-div);
38
+ }
39
+ .pnx-filter-block:first-child {
40
+ padding-top: 15px;
41
+ }
42
+ .pnx-filter-block:last-child {
43
+ border-bottom: none;
44
+ padding-bottom: 15px;
45
+ }
46
+ .pnx-filter-zoomin {
47
+ z-index: 131;
48
+ background-color: rgba(255,255,255,0.8);
49
+ text-align: center;
50
+ font-weight: 800;
51
+ position: absolute;
52
+ top: 0;
53
+ right: 0;
54
+ left: 0;
55
+ bottom: 0;
56
+ display: flex;
57
+ justify-content: center;
58
+ align-items: center;
59
+ border-radius: 25px;
60
+ }
61
+ .pnx-filter-zoomin.hidden {
62
+ display: none;
63
+ }
64
+
65
+ /* Input styles */
66
+ .pnx-filter-active,
67
+ pnx-search-bar.pnx-filter-active::part(container),
68
+ pnx-search-bar.pnx-filter-active::part(input) {
69
+ background-color: var(--widget-bg-active) !important;
70
+ border-color: var(--widget-bg-active) !important;
71
+ color: var(--widget-font-active) !important;
72
+ }
73
+ input[type=date] {
74
+ min-width: 0;
75
+ flex-grow: 2;
76
+ padding: 2px 0;
77
+ text-align: center;
78
+ background-color: var(--widget-bg);
79
+ color: var(--widget-font);
80
+ border: 1px solid var(--widget-border-div);
81
+ border-radius: 20px;
82
+ font-family: var(--font-family);
83
+ }
84
+
85
+ /* Input shortcuts */
86
+ .pnx-input-shortcuts {
87
+ margin-top: -10px;
88
+ margin-bottom: 5px;
89
+ }
90
+ .pnx-input-shortcuts button {
91
+ border: none;
92
+ font-size: 0.75em;
93
+ padding: 2px 6px;
94
+ vertical-align: middle;
95
+ background-color: var(--grey-pale);
96
+ color: var(--black);
97
+ border-radius: 10px;
98
+ cursor: pointer;
99
+ font-family: var(--font-family);
100
+ }
101
+ .pnx-input-shortcuts button:hover {
102
+ background-color: #d9dcd9;
103
+ }
104
+
105
+ /* Checkbox looking like buttons */
106
+ .pnx-input-group.pnx-checkbox-btns {
107
+ gap: 0;
108
+ align-items: stretch;
109
+ }
110
+ .pnx-checkbox-btns label {
111
+ display: inline-block;
112
+ padding: 2px 7px;
113
+ background: none;
114
+ border: 1px solid var(--widget-border-btn);
115
+ color: var(--widget-font-direct);
116
+ cursor: pointer;
117
+ font-size: 16px;
118
+ text-decoration: none;
119
+ border-left-width: 0px;
120
+ }
121
+ .pnx-checkbox-btns label:hover {
122
+ background-color: var(--widget-bg-hover);
123
+ }
124
+ .pnx-checkbox-btns label:first-of-type {
125
+ border-top-left-radius: 8px;
126
+ border-bottom-left-radius: 8px;
127
+ border-left-width: 1px;
128
+ }
129
+ .pnx-checkbox-btns label:last-of-type {
130
+ border-top-right-radius: 8px;
131
+ border-bottom-right-radius: 8px;
132
+ }
133
+ .pnx-checkbox-btns input[type="radio"] { display: none; }
134
+ .pnx-checkbox-btns input[type="radio"]:checked + label {
135
+ background-color: var(--widget-bg-active);
136
+ color: var(--widget-font-active);
137
+ }
138
+ .pnx-checkbox-btns input[type="radio"]:checked + label:first-of-type {
139
+ border-right-color: white;
140
+ }
141
+
142
+ /* Force user search width */
143
+ #pnx-filter-search-user::part(container) { width: 100%; }
144
+ ` ];
145
+
146
+ /**
147
+ * Component properties.
148
+ * @memberof Panoramax.components.ui.MapFilters#
149
+ * @type {Object}
150
+ * @property {boolean} [user-search=false] Should user search filter show up ?
151
+ * @property {boolean} [quality-score=false] Should quality score filter show up ?
152
+ */
153
+ static properties = {
154
+ "quality-score": {type: Boolean},
155
+ "user-search": {type: Boolean},
156
+ showZoomIn: {state: true},
157
+ minDate: {state: true},
158
+ maxDate: {state: true},
159
+ type: {state: true},
160
+ score: {state: true},
161
+ user: {state: true},
162
+ };
163
+
164
+ constructor() {
165
+ super();
166
+ this._formDelay = null;
167
+ this.showZoomIn = true;
168
+ }
169
+
170
+ /** @private */
171
+ connectedCallback() {
172
+ super.connectedCallback();
173
+
174
+ // Input changes
175
+ for(let i of this.shadowRoot.querySelectorAll("input")) {
176
+ i.addEventListener("change", this._onFormChange.bind(this));
177
+ i.addEventListener("keypress", this._onFormChange.bind(this));
178
+ i.addEventListener("paste", this._onFormChange.bind(this));
179
+ i.addEventListener("input", this._onFormChange.bind(this));
180
+ }
181
+
182
+ // Map zoom
183
+ this._parent?.onceMapReady?.().then(() => {
184
+ this._parent.map.on("zoomend", this._onMapZoom.bind(this));
185
+ this._parent.map.on("filters-changed", this._onParentFilterChange.bind(this));
186
+ this._onMapZoom();
187
+ this._onParentFilterChange(this._parent.map._mapFilters);
188
+ });
189
+ }
190
+
191
+ /**
192
+ * Map zoom event handler: show/hide "zoom in" labels
193
+ * @private
194
+ */
195
+ _onMapZoom() {
196
+ this.showZoomIn = this._parent.map.getZoom() < 7;
197
+ }
198
+
199
+ /**
200
+ * Filter changes on parent: update input fields
201
+ * @private
202
+ */
203
+ _onParentFilterChange(e) {
204
+ this.minDate = e?.minDate || null;
205
+ this.maxDate = e?.maxDate || null;
206
+
207
+ // Sanity check for date
208
+ if(this.minDate && this.maxDate && this.minDate > this.maxDate) {
209
+ const prevMin = this.minDate;
210
+ this.minDate = this.maxDate;
211
+ this.maxDate = prevMin;
212
+ this._onFormChange();
213
+ }
214
+
215
+ this.score = e?.qualityscore?.length < 5 ? e.qualityscore.join(",") : "";
216
+
217
+ this.type = "";
218
+ if(e?.pic_type && e.pic_type != "") {
219
+ this.type = e.pic_type == "flat" ? "flat" : "equirectangular";
220
+ }
221
+ }
222
+
223
+ /** @private */
224
+ _onSubmit(e) {
225
+ e.preventDefault();
226
+ this._onFormChange();
227
+ return false;
228
+ }
229
+
230
+ /** @private */
231
+ _onFormChange() {
232
+ if(this._formDelay) { clearTimeout(this._formDelay); }
233
+ this._formDelay = setTimeout(() => this._parent?._onMapFiltersChange(), 250);
234
+ }
235
+
236
+ /** @private */
237
+ _userSearch(value) {
238
+ return this?._parent.api.searchUsers(value)
239
+ .then(data => ((data || [])
240
+ .map(f => ({
241
+ title: f.label,
242
+ data: f
243
+ }))
244
+ ));
245
+ }
246
+
247
+ /** @private */
248
+ _onUserSearchResult(e) {
249
+ if(e.detail) { e.target.classList.add("pnx-filter-active"); }
250
+ else { e.target.classList.remove("pnx-filter-active"); }
251
+ return this._parent?.map.setVisibleUsers(e.detail?.data ? [e.detail.data.id] : ["geovisio"]);
252
+ }
253
+
254
+ /** @private */
255
+ _onReset() {
256
+ this.shadowRoot.querySelector("#pnx-filter-qualityscore")?.setAttribute("grade", "");
257
+ this.shadowRoot.querySelector("#pnx-filter-search-user")?.reset();
258
+ this.minDate = null;
259
+ this.maxDate = null;
260
+ this.type = "";
261
+ this.score = null;
262
+ this.user = null;
263
+ this._onFormChange();
264
+ }
265
+
266
+ /** @private */
267
+ _onDateShortcut(date) {
268
+ const dateFromField = this.shadowRoot.getElementById("pnx-filter-date-from");
269
+ const dateToField = this.shadowRoot.getElementById("pnx-filter-date-end");
270
+
271
+ if(dateFromField) {
272
+ if(dateFromField.value !== date) { dateFromField.value = date; }
273
+ else { dateFromField.value = ""; }
274
+ }
275
+
276
+ if(dateToField) { dateToField.value = ""; }
277
+ }
278
+
279
+ /** @private */
280
+ render() {
281
+ const userAccount = getUserAccount();
282
+
283
+ return html`<form
284
+ @reset=${this._onReset}
285
+ @change=${this._onFormChange}
286
+ @submit=${this._onSubmit}
287
+ >
288
+ <div class="pnx-filter-block">
289
+ <div class="pnx-filter-zoomin ${this.showZoomIn ? "" : "hidden"}">${this._parent?._t.pnx.filter_zoom_in}</div>
290
+ <h4>${fa(faCalendar)} ${this._parent?._t.pnx.filter_date}</h4>
291
+ <div class="pnx-input-shortcuts">
292
+ <button
293
+ @click=${() => this._onDateShortcut(new Date(new Date().setMonth(new Date().getMonth() - 1)).toISOString().split("T")[0])}
294
+ >${this._parent?._t.pnx.filter_date_1month}</button>
295
+ <button
296
+ @click=${() => this._onDateShortcut(new Date(new Date().setMonth(new Date().getMonth() - 6)).toISOString().split("T")[0])}
297
+ >${this._parent?._t.pnx.filter_date_6months}</button>
298
+ <button
299
+ @click=${() => this._onDateShortcut(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).toISOString().split("T")[0])}
300
+ >${this._parent?._t.pnx.filter_date_1year}</button>
301
+ </div>
302
+ <div class="pnx-input-group">
303
+ <input
304
+ type="date"
305
+ id="pnx-filter-date-from"
306
+ .value=${this.minDate}
307
+ class=${this.minDate && this.minDate != "" ? "pnx-filter-active" : ""}
308
+ />
309
+ ${fa(faArrowRight)}
310
+ <input
311
+ type="date"
312
+ id="pnx-filter-date-end"
313
+ .value=${this.maxDate}
314
+ class=${this.maxDate && this.maxDate != "" ? "pnx-filter-active" : ""}
315
+ />
316
+ </div>
317
+ </div>
318
+
319
+ <div class="pnx-filter-block">
320
+ <h4>${fa(faImage)} ${this._parent?._t.pnx.filter_picture}</h4>
321
+ <div class="pnx-input-group pnx-checkbox-btns" style="justify-content: center;">
322
+ <input
323
+ type="radio"
324
+ id="pnx-filter-type-all"
325
+ name="pnx-filter-type"
326
+ value=""
327
+ .checked=${!this.type || this.type === ""}
328
+ />
329
+ <label for="pnx-filter-type-all">${this._parent?._t.pnx.picture_all}</label>
330
+ <input
331
+ type="radio"
332
+ id="pnx-filter-type-flat"
333
+ name="pnx-filter-type"
334
+ value="flat"
335
+ .checked=${this.type === "flat"}
336
+ />
337
+ <label for="pnx-filter-type-flat">${this._parent?._t.pnx.picture_flat}</label>
338
+ <input
339
+ type="radio"
340
+ id="pnx-filter-type-360"
341
+ name="pnx-filter-type"
342
+ value="equirectangular"
343
+ .checked=${this.type === "equirectangular"}
344
+ />
345
+ <label for="pnx-filter-type-360">${this._parent?._t.pnx.picture_360}</label>
346
+ </div>
347
+ </div>
348
+
349
+ ${this["quality-score"] ? html`
350
+ <div class="pnx-filter-block">
351
+ <div class="pnx-filter-zoomin ${this.showZoomIn ? "" : "hidden"}">${this._parent?._t.pnx.filter_zoom_in}</div>
352
+ <h4 style="margin-bottom: 3px">
353
+ ${fa(faMedal)} ${this._parent?._t.pnx.filter_qualityscore}
354
+ <pnx-button
355
+ title="${this._parent?._t.pnx.metadata_quality_help}"
356
+ kind="superinline"
357
+ @click=${() => this._parent?._showQualityScoreDoc()}
358
+ >
359
+ ${fa(faInfoCircle)}
360
+ </pnx-button>
361
+ </h4>
362
+ <div class="pnx-input-group">
363
+ <pnx-quality-score
364
+ id="pnx-filter-qualityscore"
365
+ _t=${this._parent?._t}
366
+ input="pnx-filter-qualityscore"
367
+ grade=${this.score}
368
+ @change=${this._onFormChange}
369
+ >
370
+ </pnx-quality-score>
371
+ </div>
372
+ </div>
373
+ ` : nothing}
374
+
375
+ ${this["user-search"] ? html`
376
+ <div class="pnx-filter-block">
377
+ <h4>${fa(faUser)} ${this._parent?._t.pnx.filter_user}</h4>
378
+ ${userAccount ? html`
379
+ <div class="pnx-input-shortcuts">
380
+ <button>${this._parent?._t.pnx.filter_user_mypics}</button>
381
+ </div>
382
+ ` : nothing}
383
+ <pnx-search-bar
384
+ id="pnx-filter-search-user"
385
+ placeholder=${this._parent?._t.pnx.search_user}
386
+ class=${this.user ? "pnx-filter-active" : ""}
387
+ value=${this.user}
388
+ @result=${this._onUserSearchResult}
389
+ .searcher=${this._userSearch.bind(this)}
390
+ ._parent=${this._parent}
391
+ no-menu-closure
392
+ >
393
+ </pnx-search-bar>
394
+ </div>
395
+ ` : nothing}
396
+ </form>`;
397
+ }
398
+ }
399
+
400
+ customElements.define("pnx-map-filters-menu", MapFilters);
@@ -0,0 +1,143 @@
1
+ import { LitElement, html, css, nothing } from "lit";
2
+ import { fa } from "../../utils/widgets";
3
+ import { faSvg, titles, select } from "../styles";
4
+ import { COLORS } from "../../utils/utils";
5
+ import { faEarthEurope } from "@fortawesome/free-solid-svg-icons/faEarthEurope";
6
+ import { faPalette } from "@fortawesome/free-solid-svg-icons/faPalette";
7
+ import { faInfoCircle } from "@fortawesome/free-solid-svg-icons/faInfoCircle";
8
+
9
+ /**
10
+ * Map Layers menu allows user to select background and map theme.
11
+ * @class Panoramax.components.menus.MapLayers
12
+ * @element pnx-map-layers-menu
13
+ * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
14
+ * @example
15
+ * ```html
16
+ * <pnx-map-layers-menu _parent=${viewer} />
17
+ * ```
18
+ */
19
+ export default class MapLayers extends LitElement {
20
+ /** @private */
21
+ static styles = [ faSvg, titles, select, css`
22
+ .legend {
23
+ display: flex;
24
+ flex-wrap: wrap;
25
+ margin-top: 5px;
26
+ justify-content: space-evenly;
27
+ }
28
+
29
+ .legend-entry {
30
+ margin: 10px 8px 5px 0px;
31
+ line-height: 12px;
32
+ display: flex;
33
+ align-items: center;
34
+ font-size: 1.0em;
35
+ }
36
+
37
+ .legend-color {
38
+ display: inline-block;
39
+ width: 15px;
40
+ height: 15px;
41
+ border-radius: 3px;
42
+ margin-right: 5px;
43
+ }
44
+
45
+ .legend-score {
46
+ justify-content: center;
47
+ gap: 0;
48
+ }
49
+ ` ];
50
+
51
+ /** @private */
52
+ static properties = {
53
+ theme: {state: true},
54
+ };
55
+
56
+ /** @private */
57
+ connectedCallback() {
58
+ super.connectedCallback();
59
+ this._parent?.onceMapReady?.().then(() => {
60
+ this.theme = this._parent.map._mapFilters.theme;
61
+ this._parent.map.on("filters-changed", e => this.theme = e.theme);
62
+ });
63
+ }
64
+
65
+ /** @private */
66
+ _onThemeSelect(e) {
67
+ this.theme = e.target.value;
68
+ this._parent?._onMapFiltersChange();
69
+ }
70
+
71
+ /** @private */
72
+ render() {
73
+ const parts = [];
74
+
75
+ // Background selector
76
+ if(this._parent?.map?.hasTwoBackgrounds?.()) {
77
+ parts.push(html`
78
+ <h4>${fa(faEarthEurope)} ${this._parent?._t.pnx.map_background}</h4>
79
+ <pnx-map-background ._parent=${this._parent}></pnx-map-background>
80
+ `);
81
+ }
82
+
83
+ // Map theme selector
84
+ parts.push(html`
85
+ <h4>${fa(faPalette)} ${this._parent?._t.pnx.map_theme}</h4>
86
+ <select id="pnx-map-theme" style="width: 100%;" @change=${this._onThemeSelect}>
87
+ <option value="default" .selected=${this.theme == "default"}>${this._parent?._t.pnx.map_theme_default}</option>
88
+ <option value="age" .selected=${this.theme == "age"}>${this._parent?._t.pnx.map_theme_age}</option>
89
+ <option value="type" .selected=${this.theme == "type"}>${this._parent?._t.pnx.map_theme_type}</option>
90
+ ${this._parent?.map?._hasQualityScore?.() && html`<option value="score" .selected=${this.theme == "score"}>${this._parent?._t.pnx.map_theme_score}</option>`}
91
+ </select>
92
+ `);
93
+
94
+ // Map legend
95
+ parts.push(html`<div class="legend">
96
+ ${this.theme == "age" ? html`
97
+ <div>
98
+ <div class="legend-entry">
99
+ <span class="legend-color" style="background-color: ${COLORS["PALETTE_4"]}"></span>
100
+ ${this._parent?._t.pnx["map_theme_age_4"]}
101
+ </div>
102
+ <div class="legend-entry">
103
+ <span class="legend-color" style="background-color: ${COLORS["PALETTE_3"]}"></span>
104
+ ${this._parent?._t.pnx["map_theme_age_3"]}
105
+ </div>
106
+ </div>
107
+ <div>
108
+ <div class="legend-entry">
109
+ <span class="legend-color" style="background-color: ${COLORS["PALETTE_2"]}"></span>
110
+ ${this._parent?._t.pnx["map_theme_age_2"]}
111
+ </div>
112
+ <div class="legend-entry">
113
+ <span class="legend-color" style="background-color: ${COLORS["PALETTE_1"]}"></span>
114
+ ${this._parent?._t.pnx["map_theme_age_1"]}
115
+ </div>
116
+ </div>` : nothing}
117
+
118
+ ${this.theme == "type" ? html`
119
+ <div class="legend-entry">
120
+ <span class="legend-color" style="background-color: ${COLORS.QUALI_1}"></span>
121
+ ${this._parent?._t.pnx.picture_360}
122
+ </div>
123
+ <div class="legend-entry">
124
+ <span class="legend-color" style="background-color: ${COLORS.QUALI_2}"></span>
125
+ ${this._parent?._t.pnx.picture_flat}
126
+ </div>` : nothing}
127
+
128
+ ${this.theme == "score" ? html`<div>
129
+ <pnx-quality-score></pnx-quality-score>
130
+ <pnx-button
131
+ title="${this._parent?._t.pnx.metadata_quality_help}"
132
+ kind="superinline"
133
+ @click=${() => this._parent?._showQualityScoreDoc()}
134
+ >
135
+ ${fa(faInfoCircle)}
136
+ </pnx-button></div>` : nothing}
137
+ </div>`);
138
+
139
+ return parts;
140
+ }
141
+ }
142
+
143
+ customElements.define("pnx-map-layers-menu", MapLayers);
@@ -0,0 +1,34 @@
1
+ import {LitElement, html, nothing, css} from "lit";
2
+
3
+ /**
4
+ * Map legend displays information about map sources.
5
+ * @class Panoramax.components.menus.MapLegend
6
+ * @element pnx-map-legend
7
+ * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
8
+ * @example
9
+ * ```html
10
+ * <pnx-map-legend ._parent=${viewer} />
11
+ * ```
12
+ */
13
+ export default class MapLegend extends LitElement {
14
+ /** @private */
15
+ static styles = css`
16
+ :host {
17
+ font-size: 0.9em;
18
+ }
19
+ small {
20
+ font-size: 1em;
21
+ }
22
+ `;
23
+
24
+ /** @private */
25
+ render() {
26
+ const mapAttrib = this._parent?.map?._attribution?._innerContainer;
27
+
28
+ return html`
29
+ ${mapAttrib && mapAttrib.innerHTML.length > 0 ? html`${this._parent?._t.map.map_data}<br />${mapAttrib}` : nothing}
30
+ `;
31
+ }
32
+ }
33
+
34
+ customElements.define("pnx-map-legend", MapLegend);