@panoramax/web-viewer 5.0.0-develop-d26305dd → 5.0.0-develop-be5ba1a7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/build/cjs/index.js +1 -1
  2. package/build/cjs/index_photoviewer.js +1 -1
  3. package/build/esm/components/core/Basic.js +1 -1
  4. package/build/esm/translations/el.json +92 -1
  5. package/package.json +1 -1
  6. package/build/bundle.cjs +0 -3399
  7. package/build/bundle.cjs.map +0 -1
  8. package/build/bundle_photoviewer.cjs +0 -2510
  9. package/build/bundle_photoviewer.cjs.map +0 -1
  10. package/build/components/core/Basic.css +0 -56
  11. package/build/components/core/Basic.js +0 -378
  12. package/build/components/core/CoverageMap.css +0 -10
  13. package/build/components/core/CoverageMap.js +0 -169
  14. package/build/components/core/Editor.css +0 -33
  15. package/build/components/core/Editor.js +0 -398
  16. package/build/components/core/PhotoViewer.css +0 -70
  17. package/build/components/core/PhotoViewer.js +0 -650
  18. package/build/components/core/Viewer.css +0 -130
  19. package/build/components/core/Viewer.js +0 -711
  20. package/build/components/core/index.js +0 -10
  21. package/build/components/index.js +0 -11
  22. package/build/components/index_photoviewer.js +0 -6
  23. package/build/components/layout/BottomDrawer.js +0 -258
  24. package/build/components/layout/CorneredGrid.js +0 -143
  25. package/build/components/layout/Mini.js +0 -121
  26. package/build/components/layout/Tabs.js +0 -140
  27. package/build/components/layout/index.js +0 -9
  28. package/build/components/menus/LocationPrecisionDoc.js +0 -42
  29. package/build/components/menus/MapBackground.js +0 -110
  30. package/build/components/menus/MapFilters.js +0 -567
  31. package/build/components/menus/MapLayers.js +0 -238
  32. package/build/components/menus/MapLegend.js +0 -68
  33. package/build/components/menus/MiniPictureLegend.js +0 -73
  34. package/build/components/menus/PictureLegend.js +0 -379
  35. package/build/components/menus/PictureMetadata.js +0 -380
  36. package/build/components/menus/PlayerOptions.js +0 -93
  37. package/build/components/menus/QualityScoreDoc.js +0 -42
  38. package/build/components/menus/ReportForm.js +0 -132
  39. package/build/components/menus/SemanticsDoc.js +0 -38
  40. package/build/components/menus/SemanticsDownload.js +0 -33
  41. package/build/components/menus/SemanticsFilters.js +0 -153
  42. package/build/components/menus/SemanticsList.js +0 -413
  43. package/build/components/menus/SemanticsMetadata.js +0 -368
  44. package/build/components/menus/Share.js +0 -105
  45. package/build/components/menus/index.js +0 -22
  46. package/build/components/menus/index_photoviewer.js +0 -11
  47. package/build/components/styles.js +0 -557
  48. package/build/components/ui/AnnotationsSwitch.js +0 -159
  49. package/build/components/ui/Button.js +0 -77
  50. package/build/components/ui/ButtonGroup.css +0 -59
  51. package/build/components/ui/ButtonGroup.js +0 -69
  52. package/build/components/ui/CopyButton.js +0 -110
  53. package/build/components/ui/Grade.js +0 -54
  54. package/build/components/ui/GradeFilter.js +0 -122
  55. package/build/components/ui/IconSwitch.js +0 -193
  56. package/build/components/ui/LinkButton.js +0 -67
  57. package/build/components/ui/ListGroup.js +0 -66
  58. package/build/components/ui/ListItem.js +0 -90
  59. package/build/components/ui/Loader.js +0 -203
  60. package/build/components/ui/Map.css +0 -63
  61. package/build/components/ui/Map.js +0 -853
  62. package/build/components/ui/MapMore.js +0 -175
  63. package/build/components/ui/Photo.css +0 -50
  64. package/build/components/ui/Photo.js +0 -1502
  65. package/build/components/ui/Popup.js +0 -145
  66. package/build/components/ui/ProgressBar.js +0 -104
  67. package/build/components/ui/QualityScore.js +0 -147
  68. package/build/components/ui/SearchBar.js +0 -374
  69. package/build/components/ui/SemanticsEditor.js +0 -191
  70. package/build/components/ui/SemanticsTable.js +0 -88
  71. package/build/components/ui/Switch.js +0 -139
  72. package/build/components/ui/TogglableGroup.js +0 -157
  73. package/build/components/ui/index.js +0 -29
  74. package/build/components/ui/index_photoviewer.js +0 -21
  75. package/build/components/ui/widgets/CopyCoordinates.js +0 -75
  76. package/build/components/ui/widgets/GeoSearch.css +0 -21
  77. package/build/components/ui/widgets/GeoSearch.js +0 -150
  78. package/build/components/ui/widgets/Legend.js +0 -190
  79. package/build/components/ui/widgets/LevelSelect.css +0 -51
  80. package/build/components/ui/widgets/LevelSelect.js +0 -143
  81. package/build/components/ui/widgets/MapFiltersButton.js +0 -114
  82. package/build/components/ui/widgets/MapLayersButton.js +0 -79
  83. package/build/components/ui/widgets/OSMEditors.js +0 -155
  84. package/build/components/ui/widgets/PictureLegendActions.js +0 -99
  85. package/build/components/ui/widgets/Player.css +0 -7
  86. package/build/components/ui/widgets/Player.js +0 -154
  87. package/build/components/ui/widgets/SemanticsFiltersButton.js +0 -65
  88. package/build/components/ui/widgets/Zoom.js +0 -84
  89. package/build/components/ui/widgets/index.js +0 -16
  90. package/build/components/ui/widgets/index_photoviewer.js +0 -7
  91. package/build/img/arrow_360.svg +0 -14
  92. package/build/img/arrow_flat.svg +0 -11
  93. package/build/img/arrow_triangle.svg +0 -9
  94. package/build/img/arrow_turn.svg +0 -8
  95. package/build/img/bg_aerial.jpg +0 -0
  96. package/build/img/bg_streets.jpg +0 -0
  97. package/build/img/loader_base.jpg +0 -0
  98. package/build/img/logo_dead.svg +0 -91
  99. package/build/img/marker.svg +0 -17
  100. package/build/img/marker_blue.svg +0 -20
  101. package/build/img/osm.svg +0 -49
  102. package/build/img/panoramax.svg +0 -13
  103. package/build/img/switch_big.svg +0 -54
  104. package/build/img/switch_mini.svg +0 -48
  105. package/build/img/wd.svg +0 -1
  106. package/build/index_photoviewer.js +0 -4
  107. package/build/package.json +0 -148
  108. package/build/servers.js +0 -14
  109. package/build/translations/ar.json +0 -1
  110. package/build/translations/be.json +0 -257
  111. package/build/translations/br.json +0 -81
  112. package/build/translations/cy.json +0 -117
  113. package/build/translations/da.json +0 -300
  114. package/build/translations/de.json +0 -309
  115. package/build/translations/en.json +0 -294
  116. package/build/translations/eo.json +0 -235
  117. package/build/translations/es.json +0 -292
  118. package/build/translations/fi.json +0 -1
  119. package/build/translations/fr.json +0 -294
  120. package/build/translations/hr.json +0 -294
  121. package/build/translations/hu.json +0 -294
  122. package/build/translations/it.json +0 -306
  123. package/build/translations/ja.json +0 -182
  124. package/build/translations/ko.json +0 -1
  125. package/build/translations/nl.json +0 -305
  126. package/build/translations/nn.json +0 -1
  127. package/build/translations/pl.json +0 -169
  128. package/build/translations/pt.json +0 -296
  129. package/build/translations/pt_BR.json +0 -304
  130. package/build/translations/sv.json +0 -182
  131. package/build/translations/ti.json +0 -9
  132. package/build/translations/tr.json +0 -297
  133. package/build/translations/uk.json +0 -268
  134. package/build/translations/zh_Hant.json +0 -309
  135. package/build/utils/API.js +0 -928
  136. package/build/utils/InitParameters.js +0 -521
  137. package/build/utils/MapStyleComposer.js +0 -889
  138. package/build/utils/PanoraMapProtocol.js +0 -49
  139. package/build/utils/PhotoAdapter.js +0 -49
  140. package/build/utils/PresetsManager.js +0 -148
  141. package/build/utils/SemanticsMapProtocol.js +0 -144
  142. package/build/utils/URLHandler.js +0 -426
  143. package/build/utils/geocoder.js +0 -203
  144. package/build/utils/i18n.js +0 -128
  145. package/build/utils/index.js +0 -17
  146. package/build/utils/index_photoviewer.js +0 -14
  147. package/build/utils/indoor.js +0 -200
  148. package/build/utils/map.js +0 -788
  149. package/build/utils/picture.js +0 -507
  150. package/build/utils/semantics.js +0 -321
  151. package/build/utils/services.js +0 -148
  152. package/build/utils/utils.js +0 -433
  153. package/build/utils/widgets.js +0 -110
@@ -1,190 +0,0 @@
1
- import { LitElement, css, html, nothing } from "lit";
2
- import { panel } from "../../styles.js";
3
- import { fa, onceParentAvailable } from "../../../utils/widgets.js";
4
- import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
5
- import { classMap } from "lit/directives/class-map.js";
6
- import { PanoramaxWebsiteURL } from "../../../utils/services.js";
7
- import { svgToImg } from "../../../utils/utils.js";
8
- const PanoramaxImg = await fetch(new URL("../../../img/panoramax.svg", import.meta.url).href).then(res => res.text());
9
-
10
- /**
11
- * Legend widget, handling switch between map and photo components.
12
- * Also displays a default "About Panoramax" message.
13
- * @class Panoramax.components.ui.widgets.Legend
14
- * @element pnx-widget-legend
15
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
16
- * @slot `editors` External links to map editors, or any tool that may be helpful. Defaults to OSM tools (iD & JOSM).
17
- * @example
18
- * ```html
19
- * <!-- Default legend -->
20
- * <pnx-widget-legend
21
- * _parent=${viewer}
22
- * focus="map"
23
- * picture="PICTURE-ID-IF-ANY"
24
- * ></pnx-widget-legend>
25
- *
26
- * <!-- With custom editor links -->
27
- * <pnx-widget-legend
28
- * _parent=${viewer}
29
- * focus="map"
30
- * picture="PICTURE-ID-IF-ANY"
31
- * >
32
- * <div slot="editors"><a href="http://my.own.tool">Edit in my own tool</a></div>
33
- * </pnx-widget-legend>
34
- *
35
- * <!-- Lighter version -->
36
- * <pnx-widget-legend
37
- * _parent=${viewer}
38
- * focus="pic"
39
- * picture="PICTURE-ID-IF-ANY"
40
- * light
41
- * ></pnx-widget-legend>
42
- * ```
43
- */
44
- export default class Legend extends LitElement {
45
- /** @private */
46
- static styles = [panel, css`
47
- :host {
48
- pointer-events: none;
49
- }
50
- .pnx-panel[part="panel"] {
51
- border-radius: 10px;
52
- position: relative;
53
- max-width: 450px;
54
- z-index: 121; /* To appear above mini component */
55
- min-width: unset;
56
- pointer-events: auto;
57
- }
58
- .pnx-panel[part="panel"].pnx-padded {
59
- padding: 10px;
60
- width: 250px;
61
- }
62
- .presentation {
63
- font-size: 0.85em;
64
- line-height: 1em;
65
- display: flex;
66
- gap: 5px;
67
- align-items: center;
68
- }
69
- .logo {
70
- width: 45px;
71
- }
72
- pnx-map-legend {
73
- display: block;
74
- margin-top: 5px;
75
- }
76
-
77
- /* Lighter/smaller version */
78
- .pnx-panel[part="panel"].pnx-legend-light {
79
- display: flex;
80
- gap: 3px;
81
- padding: 3px 8px 3px 3px;
82
- width: unset;
83
- min-width: unset;
84
- align-items: center;
85
- font-size: 10px;
86
- margin-right: -10px;
87
- margin-bottom: -10px;
88
- border-radius: 0;
89
- border-top-left-radius: 5px;
90
- border-right: none;
91
- border-bottom: none;
92
- }
93
- .pnx-legend-light a,
94
- .pnx-legend-light .presentation {
95
- font-size: 10px;
96
- }
97
- .pnx-legend-light .logo {
98
- width: 15px;
99
- }
100
-
101
- .pnx-legend-light pnx-map-legend {
102
- width: max-content;
103
- margin-top: unset;
104
- font-size: 10px;
105
- }
106
- `];
107
-
108
- /**
109
- * Component properties.
110
- * @memberof Panoramax.components.ui.widgets.Legend#
111
- * @type {Object}
112
- * @property {string} [focus] The focused main component (map, pic)
113
- * @property {string} [picture] The picture ID
114
- * @property {boolean} [light=false] Lighter version (for iframes)
115
- */
116
- static properties = {
117
- focus: {type: String},
118
- picture: {type: String},
119
- light: {type: Boolean},
120
- };
121
-
122
- constructor() {
123
- super();
124
- this.light = false;
125
- }
126
-
127
- /** @private */
128
- connectedCallback() {
129
- super.connectedCallback();
130
- onceParentAvailable(this).then(() => this.requestUpdate());
131
- }
132
-
133
- render() {
134
- const classes = {
135
- "pnx-panel": true,
136
- "pnx-padded": this.focus == "map",
137
- "pnx-legend-light": this.light,
138
- };
139
-
140
- const logo = svgToImg(PanoramaxImg);
141
- logo.classList.add("logo");
142
-
143
- return html`<div class=${classMap(classes)} part="panel">
144
- <div
145
- class="presentation"
146
- style=${!this.light && this.focus != "map" && this.picture ? "display: none": ""}
147
- >
148
- ${logo}
149
-
150
- ${this.light ? html`
151
- &copy; <a
152
- href=${PanoramaxWebsiteURL()}
153
- title=${this._parent?._t.map.more_panoramax}
154
- target="_blank"
155
- >${this._parent?._t.pnx.panoramax}</a> |
156
- ` : html`
157
- <div>
158
- ${this._parent?._t.pnx.whats_panoramax}
159
- <pnx-link-button
160
- title=${this._parent?._t.map.more_panoramax}
161
- kind="superinline"
162
- href=${PanoramaxWebsiteURL()}
163
- target="_blank"
164
- size="sm"
165
- >
166
- ${fa(faInfoCircle)}
167
- </pnx-link-button>
168
- </div>
169
- `}
170
- </div>
171
- <pnx-picture-legend
172
- ._parent=${this._parent}
173
- style=${this.focus == "map" ? "display: none": ""}
174
- collapsable
175
- light=${this.light || nothing}
176
- >
177
- <slot slot="editors" name="editors">
178
- <pnx-widget-osmeditors ._parent=${this._parent} />
179
- </slot>
180
- </pnx-picture-legend>
181
- <pnx-map-legend
182
- ._parent=${this._parent}
183
- style=${this.focus != "map" ? "display: none": ""}
184
- light=${this.light || nothing}
185
- ></pnx-map-legend>
186
- </div>`;
187
- }
188
- }
189
-
190
- customElements.define("pnx-widget-legend", Legend);
@@ -1,51 +0,0 @@
1
- /*
2
- * Common rules
3
- */
4
-
5
- /* Long level numbers */
6
- pnx-level-select pnx-button.pnx-level-long::part(btn) {
7
- font-size: 0.6em;
8
- }
9
-
10
-
11
- /*
12
- * Shrink selector
13
- */
14
-
15
- pnx-level-select pnx-button {
16
- min-height: fit-content;
17
- font-family: var(--font-family);
18
- font-size: 0.9em;
19
- }
20
-
21
- pnx-level-select pnx-button.pnx-level-minimal::part(btn) {
22
- padding: 2px 5px;
23
- }
24
-
25
-
26
- /*
27
- * Expanded selector
28
- */
29
-
30
- /* Selected level */
31
- pnx-level-select pnx-button .pnx-level-active {
32
- background-color: var(--widget-bg-active);
33
- border-radius: 13px;
34
- color: var(--widget-font-active);
35
- height: 26px;
36
- line-height: 26px;
37
- width: 26px;
38
- }
39
-
40
- /* Shrink button */
41
- pnx-level-select pnx-button.pnx-level-shrink::part(btn) {
42
- border-top: 1px solid #cfcfcf !important;
43
- }
44
-
45
- /* Long list of levels scrolling */
46
- pnx-level-select .pnx-level-scroller {
47
- overflow-y: auto;
48
- overflow-x: hidden;
49
- max-height: 150px;
50
- scroll-behavior: smooth;
51
- }
@@ -1,143 +0,0 @@
1
- import { LitElement, html, nothing } from "lit";
2
- import { fa, onceParentAvailable } from "../../../utils/widgets.js";
3
- import { DISABLED_LEVEL } from "../../../utils/indoor.js";
4
- import {
5
- faCaretDown, faCaretUp, faTimes
6
- } from "@fortawesome/free-solid-svg-icons";
7
- import LevelSelectStyles from "./LevelSelect.css" with { type: "css" };
8
- import ButtonGroupStyles from "../ButtonGroup.css" with { type: "css" };
9
- document.adoptedStyleSheets.push(LevelSelectStyles);
10
- document.adoptedStyleSheets.push(ButtonGroupStyles);
11
-
12
- /**
13
- * Widget for indoor level selecting over map.
14
- * It relies on indoor= MapLibre plugin to work, so this should be enabled before calling this widget.
15
- * @class Panoramax.components.ui.widgets.LevelSelect
16
- * @element pnx-level-select
17
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
18
- * @example
19
- * ```html
20
- * <pnx-level-select _parent=${viewer} />
21
- * ```
22
- */
23
- export default class LevelSelect extends LitElement {
24
- /** @private */
25
- static properties = {
26
- _expanded: {state: true},
27
- };
28
-
29
- /** @private */
30
- createRenderRoot() {
31
- return this;
32
- }
33
-
34
- /** @private */
35
- connectedCallback() {
36
- super.connectedCallback();
37
- onceParentAvailable(this)
38
- .then(this._parent.onceMapReady?.())
39
- .then(() => {
40
- this._parent.map.indoorEqual.on("levelchange", () => this.requestUpdate());
41
- this._parent.map.indoorEqual.on("levelschange", () => this.requestUpdate());
42
- });
43
- }
44
-
45
- /** @private */
46
- updated(changedProps) {
47
- super.updated(changedProps);
48
-
49
- // Make level list scroll to see currently selected level
50
- if(this._expanded) {
51
- if(changedProps?.has("_expanded")) {
52
- this._scrollToCurrentLevel(false, "instant");
53
- } else {
54
- this._scrollToCurrentLevel(true, "smooth");
55
- }
56
- }
57
- }
58
-
59
- /** @private */
60
- _scrollToCurrentLevel(immediate, behavior) {
61
- const lvlSelected = this.renderRoot.querySelector(".pnx-level-active");
62
- setTimeout(
63
- () => lvlSelected?.scrollIntoView({behavior, block: "center", container: "nearest"}),
64
- immediate ? 0 : 50
65
- );
66
- }
67
-
68
- /** @private */
69
- render() {
70
- const ieq = this._parent.map.indoorEqual;
71
-
72
- // Disabled level = hide
73
- if(ieq.level === DISABLED_LEVEL || ieq.levels.length === 0) { return nothing; }
74
-
75
- // Find upper/lower level
76
- // Note that levels are reverse sorted
77
- const lvlId = ieq.levels.findIndex(l => l == ieq.level);
78
- const lvlUpId = lvlId > 0 ? lvlId - 1 : null;
79
- const lvlUp = lvlUpId !== null ? ieq.levels[lvlUpId] : null;
80
- const lvlDownId = lvlId < ieq.levels.length - 1 ? lvlId + 1 : null;
81
- const lvlDown = lvlDownId !== null ? ieq.levels[lvlDownId] : null;
82
-
83
- return html`
84
- <pnx-button-group
85
- dir="column"
86
- size="xl"
87
- class="pnx-print-hidden"
88
- >
89
- <pnx-button
90
- kind="superflat"
91
- @click=${() => ieq.setLevel(lvlUp)}
92
- .disabled=${lvlUp === null}
93
- class="pnx-level-minimal"
94
- title=${this._parent?._t?.pnx.indoor_selector_levelup}
95
- >${fa(faCaretUp)}</pnx-button>
96
-
97
- ${this._expanded ? html`
98
- <pnx-button-group
99
- dir="column"
100
- size="xl"
101
- class="pnx-print-hidden pnx-level-scroller"
102
- >
103
- ${ieq.levels.map(l => html`
104
- <pnx-button
105
- kind="superflat"
106
- @click=${() => ieq.setLevel(l)}
107
- class=${l.length > 2 ? "pnx-level-long" : null}
108
- >
109
- ${ieq.level == l ? html`<span class="pnx-level-active">${l}</span>`: l}
110
- </pnx-button>
111
- `)}
112
- </pnx-button-group>
113
- ` : html`
114
- <pnx-button
115
- kind="superflat"
116
- class="pnx-level-minimal"
117
- title=${this._parent?._t?.pnx.indoor_selector_expand}
118
- @click=${ieq.levels.length > 1 ? () => this._expanded = true : null}
119
- >${ieq.level}</pnx-button>
120
- `}
121
-
122
- <pnx-button
123
- kind="superflat"
124
- @click=${() => ieq.setLevel(lvlDown)}
125
- .disabled=${lvlDown === null}
126
- class="pnx-level-minimal"
127
- title=${this._parent?._t?.pnx.indoor_selector_leveldown}
128
- >${fa(faCaretDown)}</pnx-button>
129
-
130
- ${this._expanded ? html`
131
- <pnx-button
132
- kind="flat"
133
- class="pnx-level-shrink"
134
- @click=${() => this._expanded = false}
135
- title=${this._parent?._t?.pnx.indoor_selector_shrink}
136
- >${fa(faTimes)}</pnx-button>
137
- ` : nothing}
138
- </pnx-button-group>
139
- `;
140
- }
141
- }
142
-
143
- customElements.define("pnx-level-select", LevelSelect);
@@ -1,114 +0,0 @@
1
- import { LitElement, html, nothing } from "lit";
2
- import { fa, onceParentAvailable } from "../../../utils/widgets.js";
3
- import {
4
- faChevronDown, faSliders, faXmark
5
- } from "@fortawesome/free-solid-svg-icons";
6
- import { activeIcon } from "../../styles.js";
7
-
8
- /**
9
- * Collapsible button showing off map filters menus.
10
- * @class Panoramax.components.ui.widgets.MapFiltersButton
11
- * @element pnx-widget-mapfilters
12
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
13
- * @example
14
- * ```html
15
- * <pnx-widget-mapfilters user-search="" _parent=${viewer} />
16
- * ```
17
- */
18
- export default class MapFiltersButton extends LitElement {
19
- /** @private */
20
- static styles = [activeIcon];
21
-
22
- /**
23
- * Component properties.
24
- * @memberof Panoramax.components.ui.widgets.MapFiltersButton#
25
- * @type {Object}
26
- * @property {boolean} [user-search=false] Should user search filter show up ?
27
- * @property {boolean} [quality-score=false] Should quality score filter show up ?
28
- * @property {boolean} [no-date=false] Should date filters be hidden ?
29
- * @property {boolean} [no-picture-type=false] Should picture type filter be hidden ?
30
- * @property {boolean} [no-gps=false] Should GPS precision filter be hidden ?
31
- * @property {boolean} [no-source=false] Should pictures source (world, instance) filter be hidden ?
32
- */
33
- static properties = {
34
- "quality-score": {type: Boolean}, // Should be available in pnx-map-filters-menu as well
35
- "user-search": {type: Boolean}, // Should be available in pnx-map-filters-menu as well
36
- "no-date": {type: Boolean}, // Should be available in pnx-map-filters-menu as well
37
- "no-picture-type": {type: Boolean}, // Should be available in pnx-map-filters-menu as well
38
- "no-gps": {type: Boolean}, // Should be available in pnx-map-filters-menu as well
39
- "no-source": {type: Boolean}, // Should be available in pnx-map-filters-menu as well
40
- _active: {state: true},
41
- };
42
-
43
- constructor() {
44
- super();
45
-
46
- // Add them in render below as well
47
- this["user-search"] = false;
48
- this["quality-score"] = false;
49
- this["no-date"] = false;
50
- this["no-picture-type"] = false;
51
- this["no-gps"] = false;
52
- this["no-source"] = false;
53
- this._active = false;
54
- }
55
-
56
- /** @private */
57
- connectedCallback() {
58
- super.connectedCallback();
59
-
60
- // Listen to user visibility changes to switch the filter active icon
61
- onceParentAvailable(this).then(() => this._parent?.onceMapReady?.().then(() => {
62
- this._active = this._isActive();
63
- this._parent.mapStyleComposer.addEventListener("filters-changed", () => this._active = this._isActive());
64
- this._parent.mapStyleComposer.addEventListener("panoramax-changed", () => this._active = this._isActive());
65
- }));
66
- }
67
-
68
- /** @private */
69
- _isActive() {
70
- return Object
71
- .entries(this._parent.mapStyleComposer.panoramaxFilters)
72
- .filter(([k,v]) => k && v && !["featuresRestrictions", "theme"].includes(k)).length > 0
73
- || this._parent.mapStyleComposer.isPanoramaxEndpointSingleUser();
74
- }
75
-
76
- /** @private */
77
- render() {
78
- const isSmall = this._parent?.isWidthSmall() || this._parent?.isWidthMedium();
79
- const resetIcon = fa(faXmark, {styles: {"pointer-events": "auto"}});
80
- resetIcon.addEventListener("click", e => {
81
- e.stopPropagation();
82
- this.shadowRoot.querySelector("pnx-map-filters-menu")._onReset();
83
- this.shadowRoot.querySelector("#pnx-widget-filter")._opened = false;
84
- });
85
-
86
- return html`
87
- <pnx-togglable-group
88
- id="pnx-widget-filter"
89
- padded="false"
90
- class="pnx-only-map pnx-print-hidden"
91
- ._parent=${this._parent}
92
- >
93
- <pnx-button kind="flat" size="xl" slot="button">
94
- ${fa(faSliders)}
95
- ${this._active ? html`<span class="pnx-active-icon"></span>` : nothing}
96
- ${isSmall ? nothing : this._parent?._t.pnx.filters}
97
- ${isSmall ? nothing : (this._active ? resetIcon : fa(faChevronDown))}
98
- </pnx-button>
99
- <pnx-map-filters-menu
100
- id="pnx-map-filters-menu"
101
- ._parent=${this._parent}
102
- user-search=${this["user-search"]}
103
- quality-score=${this["quality-score"]}
104
- .no-date=${this["no-date"]}
105
- .no-picture-type=${this["no-picture-type"]}
106
- .no-gps=${this["no-gps"]}
107
- .no-source=${this["no-source"]}
108
- ></pnx-map-filters-menu>
109
- </pnx-togglable-group>
110
- `;
111
- }
112
- }
113
-
114
- customElements.define("pnx-widget-mapfilters", MapFiltersButton);
@@ -1,79 +0,0 @@
1
- import { LitElement, html, nothing } from "lit";
2
- import { fa, onceParentAvailable } from "../../../utils/widgets.js";
3
- import {
4
- faChevronDown, faLayerGroup, faXmark
5
- } from "@fortawesome/free-solid-svg-icons";
6
- import { activeIcon } from "../../styles.js";
7
-
8
- /**
9
- * Collapsible button showing off map filters menus.
10
- * @class Panoramax.components.ui.widgets.MapLayersButton
11
- * @element pnx-widget-maplayers
12
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
13
- * @example
14
- * ```html
15
- * <pnx-widget-maplayers _parent=${viewer} />
16
- * ```
17
- */
18
- export default class MapLayersButton extends LitElement {
19
- /** @private */
20
- static styles = [activeIcon];
21
-
22
- /** @private */
23
- static properties = {
24
- _active: {state: true},
25
- };
26
-
27
- constructor() {
28
- super();
29
- this._active = false;
30
- }
31
-
32
- /** @private */
33
- connectedCallback() {
34
- super.connectedCallback();
35
-
36
- const nullThemes = [undefined, null, "", "default"];
37
-
38
- onceParentAvailable(this).then(() => this._parent?.onceMapReady?.().then(() => {
39
- this._active = !nullThemes.includes(this._parent.mapStyleComposer.panoramaxTheme);
40
- this._parent.mapStyleComposer.addEventListener("theme-changed", e => {
41
- this._active = !nullThemes.includes(e.detail.theme);
42
- });
43
- }));
44
- }
45
-
46
- /** @private */
47
- render() {
48
- const isSmall = this._parent?.isWidthSmall() || this._parent?.isWidthMedium();
49
- const resetIcon = fa(faXmark, {styles: {"pointer-events": "auto"}});
50
- resetIcon.addEventListener("click", e => {
51
- e.stopPropagation();
52
- const menu = this.shadowRoot.querySelector("pnx-map-layers-menu");
53
- menu.shadowRoot.querySelector("#pnx-map-theme").value = "default";
54
- menu._onThemeSelect({target: {value: "default"}});
55
- this.shadowRoot.querySelector("#pnx-widget-map-layers")._opened = false;
56
- });
57
-
58
- return html`
59
- <pnx-togglable-group
60
- id="pnx-widget-map-layers"
61
- class="pnx-print-hidden"
62
- ._parent=${this._parent}
63
- >
64
- <pnx-button kind="flat" size="xl" slot="button">
65
- ${fa(faLayerGroup)}
66
- ${this._active ? html`<span class="pnx-active-icon"></span>` : nothing}
67
- ${isSmall ? nothing : this._parent?._t.pnx.layers}
68
- ${isSmall ? nothing : (this._active ? resetIcon : fa(faChevronDown))}
69
- </pnx-button>
70
- <pnx-map-layers-menu
71
- id="pnx-map-layers-menu"
72
- ._parent=${this._parent}
73
- ></pnx-map-layers-menu>
74
- </pnx-togglable-group>
75
- `;
76
- }
77
- }
78
-
79
- customElements.define("pnx-widget-maplayers", MapLayersButton);