@panoramax/web-viewer 3.2.3-develop-f219e404 → 3.2.3-develop-6257391e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +3 -0
- package/CHANGELOG.md +19 -0
- package/CODE_OF_CONDUCT.md +1 -1
- package/README.md +1 -1
- package/build/editor.html +10 -1
- package/build/index.css +2 -2
- package/build/index.css.map +1 -1
- package/build/index.html +1 -1
- package/build/index.js +1682 -5
- package/build/index.js.map +1 -1
- package/build/map.html +1 -1
- package/build/viewer.html +10 -1
- package/build/widgets.html +1 -0
- package/config/jest/mocks.js +172 -0
- package/config/paths.js +1 -0
- package/config/webpack.config.js +26 -0
- package/docs/03_URL_settings.md +3 -11
- package/docs/05_Compatibility.md +59 -76
- package/docs/09_Develop.md +30 -11
- package/docs/90_Releases.md +2 -2
- package/docs/images/class_diagram.drawio +28 -28
- package/docs/images/class_diagram.jpg +0 -0
- package/docs/index.md +112 -0
- package/docs/reference/components/core/Basic.md +153 -0
- package/docs/reference/components/core/CoverageMap.md +160 -0
- package/docs/reference/components/core/Editor.md +172 -0
- package/docs/reference/components/core/Viewer.md +288 -0
- package/docs/reference/components/layout/CorneredGrid.md +29 -0
- package/docs/reference/components/layout/Mini.md +45 -0
- package/docs/reference/components/menus/MapBackground.md +32 -0
- package/docs/reference/components/menus/MapFilters.md +15 -0
- package/docs/reference/components/menus/MapLayers.md +15 -0
- package/docs/reference/components/menus/MapLegend.md +15 -0
- package/docs/reference/components/menus/PictureLegend.md +15 -0
- package/docs/reference/components/menus/PictureMetadata.md +15 -0
- package/docs/reference/components/menus/PlayerOptions.md +15 -0
- package/docs/reference/components/menus/QualityScoreDoc.md +15 -0
- package/docs/reference/components/menus/ReportForm.md +15 -0
- package/docs/reference/components/menus/ShareMenu.md +15 -0
- package/docs/reference/components/ui/Button.md +39 -0
- package/docs/reference/components/ui/ButtonGroup.md +36 -0
- package/docs/reference/components/ui/CopyButton.md +35 -0
- package/docs/reference/components/ui/Grade.md +32 -0
- package/docs/reference/components/ui/LinkButton.md +44 -0
- package/docs/reference/components/ui/Loader.md +54 -0
- package/docs/reference/components/ui/Map.md +214 -0
- package/docs/reference/components/ui/MapMore.md +233 -0
- package/docs/reference/components/ui/Photo.md +369 -0
- package/docs/reference/components/ui/Popup.md +56 -0
- package/docs/reference/components/ui/QualityScore.md +45 -0
- package/docs/reference/components/ui/SearchBar.md +63 -0
- package/docs/reference/components/ui/TogglableGroup.md +39 -0
- package/docs/reference/components/ui/widgets/GeoSearch.md +32 -0
- package/docs/reference/components/ui/widgets/Legend.md +32 -0
- package/docs/reference/components/ui/widgets/MapFiltersButton.md +33 -0
- package/docs/reference/components/ui/widgets/MapLayersButton.md +15 -0
- package/docs/reference/components/ui/widgets/Player.md +32 -0
- package/docs/reference/components/ui/widgets/Share.md +15 -0
- package/docs/reference/components/ui/widgets/Zoom.md +15 -0
- package/docs/reference/utils/API.md +311 -0
- package/docs/reference/utils/InitParameters.md +67 -0
- package/docs/reference/utils/URLHandler.md +102 -0
- package/docs/reference.md +73 -0
- package/docs/shortcuts.md +11 -0
- package/docs/tutorials/aerial_imagery.md +19 -0
- package/docs/tutorials/authentication.md +10 -0
- package/docs/tutorials/custom_widgets.md +64 -0
- package/docs/tutorials/map_style.md +27 -0
- package/docs/tutorials/migrate_v4.md +122 -0
- package/docs/tutorials/synced_coverage.md +42 -0
- package/mkdocs.yml +60 -5
- package/package.json +10 -7
- package/public/editor.html +21 -29
- package/public/index.html +3 -3
- package/public/map.html +19 -18
- package/public/viewer.html +18 -24
- package/public/widgets.html +265 -0
- package/scripts/doc.js +77 -0
- package/src/components/core/Basic.css +44 -0
- package/src/components/core/Basic.js +258 -0
- package/src/components/core/CoverageMap.css +9 -0
- package/src/components/core/CoverageMap.js +105 -0
- package/src/components/core/Editor.css +23 -0
- package/src/components/core/Editor.js +354 -0
- package/src/components/core/Viewer.css +109 -0
- package/src/components/core/Viewer.js +707 -0
- package/src/components/core/index.js +11 -0
- package/src/components/index.js +13 -0
- package/src/components/layout/CorneredGrid.js +109 -0
- package/src/components/layout/Mini.js +117 -0
- package/src/components/layout/index.js +7 -0
- package/src/components/menus/MapBackground.js +106 -0
- package/src/components/menus/MapFilters.js +386 -0
- package/src/components/menus/MapLayers.js +143 -0
- package/src/components/menus/MapLegend.js +54 -0
- package/src/components/menus/PictureLegend.js +103 -0
- package/src/components/menus/PictureMetadata.js +188 -0
- package/src/components/menus/PlayerOptions.js +96 -0
- package/src/components/menus/QualityScoreDoc.js +36 -0
- package/src/components/menus/ReportForm.js +133 -0
- package/src/components/menus/Share.js +228 -0
- package/src/components/menus/index.js +15 -0
- package/src/components/styles.js +365 -0
- package/src/components/ui/Button.js +75 -0
- package/src/components/ui/ButtonGroup.css +49 -0
- package/src/components/ui/ButtonGroup.js +68 -0
- package/src/components/ui/CopyButton.js +71 -0
- package/src/components/ui/Grade.js +54 -0
- package/src/components/ui/LinkButton.js +68 -0
- package/src/components/ui/Loader.js +188 -0
- package/src/components/{Map.css → ui/Map.css} +5 -17
- package/src/components/{Map.js → ui/Map.js} +114 -138
- package/src/components/ui/MapMore.js +324 -0
- package/src/components/{Photo.css → ui/Photo.css} +6 -6
- package/src/components/{Photo.js → ui/Photo.js} +279 -90
- package/src/components/ui/Popup.js +145 -0
- package/src/components/ui/QualityScore.js +152 -0
- package/src/components/ui/SearchBar.js +363 -0
- package/src/components/ui/TogglableGroup.js +162 -0
- package/src/components/ui/index.js +20 -0
- package/src/components/ui/widgets/GeoSearch.css +21 -0
- package/src/components/ui/widgets/GeoSearch.js +139 -0
- package/src/components/ui/widgets/Legend.js +51 -0
- package/src/components/ui/widgets/MapFiltersButton.js +104 -0
- package/src/components/ui/widgets/MapLayersButton.js +79 -0
- package/src/components/ui/widgets/Player.css +7 -0
- package/src/components/ui/widgets/Player.js +148 -0
- package/src/components/ui/widgets/Share.js +30 -0
- package/src/components/ui/widgets/Zoom.js +82 -0
- package/src/components/ui/widgets/index.js +12 -0
- package/src/img/panoramax.svg +13 -0
- package/src/img/switch_big.svg +20 -10
- package/src/index.js +6 -9
- package/src/translations/da.json +1 -1
- package/src/translations/de.json +1 -1
- package/src/translations/en.json +5 -3
- package/src/translations/eo.json +1 -1
- package/src/translations/es.json +1 -1
- package/src/translations/fr.json +5 -3
- package/src/translations/hu.json +1 -1
- package/src/translations/it.json +1 -1
- package/src/translations/ja.json +1 -1
- package/src/translations/nl.json +1 -1
- package/src/translations/pl.json +1 -1
- package/src/translations/sv.json +33 -3
- package/src/translations/zh_Hant.json +1 -1
- package/src/utils/API.js +74 -42
- package/src/utils/InitParameters.js +354 -0
- package/src/utils/URLHandler.js +364 -0
- package/src/utils/geocoder.js +116 -0
- package/src/utils/{I18n.js → i18n.js} +3 -1
- package/src/utils/index.js +11 -0
- package/src/utils/{Map.js → map.js} +216 -80
- package/src/utils/picture.js +433 -0
- package/src/utils/utils.js +315 -0
- package/src/utils/widgets.js +93 -0
- package/tests/components/ui/CopyButton.test.js +52 -0
- package/tests/components/ui/Loader.test.js +54 -0
- package/tests/components/{Map.test.js → ui/Map.test.js} +19 -61
- package/tests/components/{Photo.test.js → ui/Photo.test.js} +89 -57
- package/tests/components/ui/Popup.test.js +24 -0
- package/tests/components/ui/QualityScore.test.js +17 -0
- package/tests/components/ui/SearchBar.test.js +107 -0
- package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +34 -0
- package/tests/components/ui/__snapshots__/Loader.test.js.snap +56 -0
- package/tests/components/{__snapshots__ → ui/__snapshots__}/Map.test.js.snap +11 -38
- package/tests/components/{__snapshots__ → ui/__snapshots__}/Photo.test.js.snap +57 -4
- package/tests/components/ui/__snapshots__/Popup.test.js.snap +29 -0
- package/tests/components/ui/__snapshots__/QualityScore.test.js.snap +11 -0
- package/tests/components/ui/__snapshots__/SearchBar.test.js.snap +65 -0
- package/tests/utils/API.test.js +1 -14
- package/tests/utils/InitParameters.test.js +485 -0
- package/tests/utils/URLHandler.test.js +350 -0
- package/tests/utils/__snapshots__/URLHandler.test.js.snap +21 -0
- package/tests/utils/__snapshots__/picture.test.js.snap +315 -0
- package/tests/utils/__snapshots__/widgets.test.js.snap +19 -0
- package/tests/utils/geocoder.test.js +37 -0
- package/tests/utils/{I18n.test.js → i18n.test.js} +1 -1
- package/tests/utils/map.test.js +67 -0
- package/tests/utils/picture.test.js +745 -0
- package/tests/utils/utils.test.js +288 -0
- package/tests/utils/widgets.test.js +90 -0
- package/docs/01_Start.md +0 -149
- package/docs/02_Usage.md +0 -831
- package/docs/04_Advanced_examples.md +0 -216
- package/src/Editor.css +0 -37
- package/src/Editor.js +0 -361
- package/src/StandaloneMap.js +0 -114
- package/src/Viewer.css +0 -203
- package/src/Viewer.js +0 -1246
- package/src/components/CoreView.css +0 -70
- package/src/components/CoreView.js +0 -175
- package/src/components/Loader.css +0 -74
- package/src/components/Loader.js +0 -120
- package/src/utils/Exif.js +0 -193
- package/src/utils/Utils.js +0 -631
- package/src/utils/Widgets.js +0 -562
- package/src/viewer/URLHash.js +0 -469
- package/src/viewer/Widgets.css +0 -880
- package/src/viewer/Widgets.js +0 -1470
- package/tests/Editor.test.js +0 -126
- package/tests/StandaloneMap.test.js +0 -45
- package/tests/Viewer.test.js +0 -366
- package/tests/__snapshots__/Editor.test.js.snap +0 -298
- package/tests/__snapshots__/StandaloneMap.test.js.snap +0 -30
- package/tests/__snapshots__/Viewer.test.js.snap +0 -195
- package/tests/components/CoreView.test.js +0 -92
- package/tests/components/Loader.test.js +0 -38
- package/tests/components/__snapshots__/Loader.test.js.snap +0 -15
- package/tests/utils/Exif.test.js +0 -124
- package/tests/utils/Map.test.js +0 -113
- package/tests/utils/Utils.test.js +0 -300
- package/tests/utils/Widgets.test.js +0 -107
- package/tests/utils/__snapshots__/Exif.test.js.snap +0 -43
- package/tests/utils/__snapshots__/Utils.test.js.snap +0 -41
- package/tests/utils/__snapshots__/Widgets.test.js.snap +0 -44
- package/tests/viewer/URLHash.test.js +0 -559
- package/tests/viewer/Widgets.test.js +0 -127
- package/tests/viewer/__snapshots__/URLHash.test.js.snap +0 -108
- package/tests/viewer/__snapshots__/Widgets.test.js.snap +0 -403
- /package/tests/utils/__snapshots__/{Map.test.js.snap → geocoder.test.js.snap} +0 -0
|
@@ -0,0 +1,386 @@
|
|
|
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 { faPanorama } from "@fortawesome/free-solid-svg-icons/faPanorama";
|
|
9
|
+
import { faMedal } from "@fortawesome/free-solid-svg-icons/faMedal";
|
|
10
|
+
import { faInfoCircle } from "@fortawesome/free-solid-svg-icons/faInfoCircle";
|
|
11
|
+
import { faUser } from "@fortawesome/free-solid-svg-icons/faUser";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Map Filters menu allows user to select map data they want displayed.
|
|
15
|
+
* @class Panoramax.components.menus.MapFilters
|
|
16
|
+
* @element pnx-map-filters-menu
|
|
17
|
+
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
|
|
18
|
+
* @example
|
|
19
|
+
* ```html
|
|
20
|
+
* <pnx-map-filters-menu user-search="" _parent=${viewer} />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export default class MapFilters extends LitElement {
|
|
24
|
+
/** @private */
|
|
25
|
+
static styles = [ faSvg, titles, css`
|
|
26
|
+
.pnx-input-group {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
gap: 5px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Filter block */
|
|
35
|
+
.pnx-filter-block {
|
|
36
|
+
position: relative;
|
|
37
|
+
padding: 10px 15px;
|
|
38
|
+
border-bottom: 2px solid var(--widget-border-div);
|
|
39
|
+
}
|
|
40
|
+
.pnx-filter-block:first-child {
|
|
41
|
+
padding-top: 15px;
|
|
42
|
+
}
|
|
43
|
+
.pnx-filter-block:last-child {
|
|
44
|
+
border-bottom: none;
|
|
45
|
+
padding-bottom: 15px;
|
|
46
|
+
}
|
|
47
|
+
.pnx-filter-zoomin {
|
|
48
|
+
z-index: 131;
|
|
49
|
+
background-color: rgba(255,255,255,0.8);
|
|
50
|
+
text-align: center;
|
|
51
|
+
font-weight: bold;
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 0;
|
|
54
|
+
right: 0;
|
|
55
|
+
left: 0;
|
|
56
|
+
bottom: 0;
|
|
57
|
+
display: flex;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
align-items: center;
|
|
60
|
+
border-radius: 25px;
|
|
61
|
+
}
|
|
62
|
+
.pnx-filter-zoomin.hidden {
|
|
63
|
+
display: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Input styles */
|
|
67
|
+
.pnx-filter-active,
|
|
68
|
+
pnx-search-bar.pnx-filter-active::part(container),
|
|
69
|
+
pnx-search-bar.pnx-filter-active::part(input) {
|
|
70
|
+
background-color: var(--widget-bg-active) !important;
|
|
71
|
+
border-color: var(--widget-bg-active) !important;
|
|
72
|
+
color: var(--widget-font-active) !important;
|
|
73
|
+
}
|
|
74
|
+
input[type=date] {
|
|
75
|
+
min-width: 0;
|
|
76
|
+
flex-grow: 2;
|
|
77
|
+
padding: 2px 0;
|
|
78
|
+
text-align: center;
|
|
79
|
+
background-color: var(--widget-bg);
|
|
80
|
+
color: var(--widget-font);
|
|
81
|
+
border: 1px solid var(--widget-border-div);
|
|
82
|
+
border-radius: 20px;
|
|
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
|
+
height: 20px;
|
|
93
|
+
line-height: 20px;
|
|
94
|
+
font-size: 11px;
|
|
95
|
+
padding: 0 8px;
|
|
96
|
+
vertical-align: middle;
|
|
97
|
+
background-color: var(--grey-pale);
|
|
98
|
+
color: var(--black);
|
|
99
|
+
border-radius: 10px;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
}
|
|
102
|
+
.pnx-input-shortcuts button:hover {
|
|
103
|
+
background-color: #d9dcd9;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Checkbox looking like buttons */
|
|
107
|
+
.pnx-input-group.pnx-checkbox-btns {
|
|
108
|
+
gap: 0;
|
|
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="checkbox"] { display: none; }
|
|
134
|
+
.pnx-checkbox-btns input[type="checkbox"]:checked + label {
|
|
135
|
+
background-color: var(--widget-bg-active);
|
|
136
|
+
color: var(--widget-font-active);
|
|
137
|
+
}
|
|
138
|
+
.pnx-checkbox-btns input[type="checkbox"]: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
|
+
typeFlat: {state: true},
|
|
160
|
+
type360: {state: true},
|
|
161
|
+
score: {state: true},
|
|
162
|
+
user: {state: true},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
constructor() {
|
|
166
|
+
super();
|
|
167
|
+
this._formDelay = null;
|
|
168
|
+
this.showZoomIn = true;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** @private */
|
|
172
|
+
connectedCallback() {
|
|
173
|
+
super.connectedCallback();
|
|
174
|
+
|
|
175
|
+
// Input changes
|
|
176
|
+
for(let i of this.shadowRoot.querySelectorAll("input")) {
|
|
177
|
+
i.addEventListener("change", this._onFormChange.bind(this));
|
|
178
|
+
i.addEventListener("keypress", this._onFormChange.bind(this));
|
|
179
|
+
i.addEventListener("paste", this._onFormChange.bind(this));
|
|
180
|
+
i.addEventListener("input", this._onFormChange.bind(this));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Map zoom
|
|
184
|
+
this._parent?.onceMapReady?.().then(() => {
|
|
185
|
+
this._parent.map.on("zoomend", this._onMapZoom.bind(this));
|
|
186
|
+
this._parent.map.on("filters-changed", this._onParentFilterChange.bind(this));
|
|
187
|
+
this._onMapZoom();
|
|
188
|
+
this._onParentFilterChange(this._parent.map._mapFilters);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Map zoom event handler: show/hide "zoom in" labels
|
|
194
|
+
* @private
|
|
195
|
+
*/
|
|
196
|
+
_onMapZoom() {
|
|
197
|
+
this.showZoomIn = this._parent.map.getZoom() < 7;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Filter changes on parent: update input fields
|
|
202
|
+
* @private
|
|
203
|
+
*/
|
|
204
|
+
_onParentFilterChange(e) {
|
|
205
|
+
this.minDate = e?.minDate || null;
|
|
206
|
+
this.maxDate = e?.maxDate || null;
|
|
207
|
+
this.score = e?.qualityscore?.length < 5 ? e.qualityscore.join(",") : "";
|
|
208
|
+
|
|
209
|
+
if(e?.pic_type && e.pic_type != "") {
|
|
210
|
+
this.type360 = e.pic_type == "equirectangular";
|
|
211
|
+
this.typeFlat = e.pic_type == "flat";
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if(this.type360 === this.typeFlat) {
|
|
215
|
+
this.type360 = false;
|
|
216
|
+
this.typeFlat = false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** @private */
|
|
221
|
+
_onSubmit(e) {
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
this._onFormChange();
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** @private */
|
|
228
|
+
_onFormChange() {
|
|
229
|
+
if(this._formDelay) { clearTimeout(this._formDelay); }
|
|
230
|
+
this._formDelay = setTimeout(() => this._parent?._onMapFiltersChange(), 250);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** @private */
|
|
234
|
+
_userSearch(value) {
|
|
235
|
+
return this?._parent.api.searchUsers(value)
|
|
236
|
+
.then(data => ((data || [])
|
|
237
|
+
.map(f => ({
|
|
238
|
+
title: f.label,
|
|
239
|
+
data: f
|
|
240
|
+
}))
|
|
241
|
+
));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** @private */
|
|
245
|
+
_onUserSearchResult(e) {
|
|
246
|
+
if(e.detail) { e.target.classList.add("pnx-filter-active"); }
|
|
247
|
+
else { e.target.classList.remove("pnx-filter-active"); }
|
|
248
|
+
return this._parent?.map.setVisibleUsers(e.detail?.data ? [e.detail.data.id] : ["geovisio"]);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** @private */
|
|
252
|
+
_onReset() {
|
|
253
|
+
this.shadowRoot.querySelector("#pnx-filter-qualityscore")?.setAttribute("grade", "");
|
|
254
|
+
this.shadowRoot.querySelector("#pnx-filter-search-user")?.reset();
|
|
255
|
+
this.minDate = null;
|
|
256
|
+
this.maxDate = null;
|
|
257
|
+
this.typeFlat = null;
|
|
258
|
+
this.type360 = null;
|
|
259
|
+
this.score = null;
|
|
260
|
+
this.user = null;
|
|
261
|
+
this._onFormChange();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Shortcut button click: change associated input value
|
|
266
|
+
* @private
|
|
267
|
+
*/
|
|
268
|
+
_onShortcutClick(field, value) {
|
|
269
|
+
return () => {
|
|
270
|
+
const elem = this.shadowRoot.getElementById(field);
|
|
271
|
+
if(elem) {
|
|
272
|
+
if(elem.value !== value) { elem.value = value; }
|
|
273
|
+
else { elem.value = ""; }
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** @private */
|
|
279
|
+
render() {
|
|
280
|
+
const userAccount = getUserAccount();
|
|
281
|
+
|
|
282
|
+
return html`<form
|
|
283
|
+
@reset=${this._onReset}
|
|
284
|
+
@change=${this._onFormChange}
|
|
285
|
+
@submit=${this._onSubmit}
|
|
286
|
+
>
|
|
287
|
+
<div class="pnx-filter-block">
|
|
288
|
+
<div class="pnx-filter-zoomin ${this.showZoomIn ? "" : "hidden"}">${this._parent?._t.pnx.filter_zoom_in}</div>
|
|
289
|
+
<h4>${fa(faCalendar)} ${this._parent?._t.pnx.filter_date}</h4>
|
|
290
|
+
<div class="pnx-input-shortcuts">
|
|
291
|
+
<button
|
|
292
|
+
@click=${this._onShortcutClick("pnx-filter-date-from", new Date(new Date().setMonth(new Date().getMonth() - 1)).toISOString().split("T")[0])}
|
|
293
|
+
>${this._parent?._t.pnx.filter_date_1month}</button>
|
|
294
|
+
<button
|
|
295
|
+
@click=${this._onShortcutClick("pnx-filter-date-from", new Date(new Date().setFullYear(new Date().getFullYear() - 1)).toISOString().split("T")[0])}
|
|
296
|
+
>${this._parent?._t.pnx.filter_date_1year}</button>
|
|
297
|
+
</div>
|
|
298
|
+
<div class="pnx-input-group">
|
|
299
|
+
<input
|
|
300
|
+
type="date"
|
|
301
|
+
id="pnx-filter-date-from"
|
|
302
|
+
.value=${this.minDate}
|
|
303
|
+
class=${this.minDate && this.minDate != "" ? "pnx-filter-active" : ""}
|
|
304
|
+
/>
|
|
305
|
+
${fa(faArrowRight)}
|
|
306
|
+
<input
|
|
307
|
+
type="date"
|
|
308
|
+
id="pnx-filter-date-end"
|
|
309
|
+
.value=${this.maxDate}
|
|
310
|
+
class=${this.maxDate && this.maxDate != "" ? "pnx-filter-active" : ""}
|
|
311
|
+
/>
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
<div class="pnx-filter-block">
|
|
316
|
+
<h4>${fa(faImage)} ${this._parent?._t.pnx.filter_picture}</h4>
|
|
317
|
+
<div class="pnx-input-group pnx-checkbox-btns" style="justify-content: center;">
|
|
318
|
+
<input
|
|
319
|
+
type="checkbox"
|
|
320
|
+
id="pnx-filter-type-flat"
|
|
321
|
+
name="flat"
|
|
322
|
+
.checked=${this.typeFlat}
|
|
323
|
+
/>
|
|
324
|
+
<label for="pnx-filter-type-flat">${fa(faImage)} ${this._parent?._t.pnx.picture_flat}</label>
|
|
325
|
+
<input
|
|
326
|
+
type="checkbox"
|
|
327
|
+
id="pnx-filter-type-360"
|
|
328
|
+
name="360"
|
|
329
|
+
.checked=${this.type360}
|
|
330
|
+
/>
|
|
331
|
+
<label for="pnx-filter-type-360">${fa(faPanorama)} ${this._parent?._t.pnx.picture_360}</label>
|
|
332
|
+
</div>
|
|
333
|
+
</div>
|
|
334
|
+
|
|
335
|
+
${this["quality-score"] ? html`
|
|
336
|
+
<div class="pnx-filter-block">
|
|
337
|
+
<div class="pnx-filter-zoomin ${this.showZoomIn ? "" : "hidden"}">${this._parent?._t.pnx.filter_zoom_in}</div>
|
|
338
|
+
<h4 style="margin-bottom: 3px">
|
|
339
|
+
${fa(faMedal)} ${this._parent?._t.pnx.filter_qualityscore}
|
|
340
|
+
<pnx-button
|
|
341
|
+
title="${this._parent?._t.pnx.metadata_quality_help}"
|
|
342
|
+
kind="outline"
|
|
343
|
+
@click=${() => this._parent?._showQualityScoreDoc()}
|
|
344
|
+
>
|
|
345
|
+
${fa(faInfoCircle)}
|
|
346
|
+
</pnx-button>
|
|
347
|
+
</h4>
|
|
348
|
+
<div class="pnx-input-group">
|
|
349
|
+
<pnx-quality-score
|
|
350
|
+
id="pnx-filter-qualityscore"
|
|
351
|
+
_t=${this._parent?._t}
|
|
352
|
+
input="pnx-filter-qualityscore"
|
|
353
|
+
grade=${this.score}
|
|
354
|
+
@change=${this._onFormChange}
|
|
355
|
+
>
|
|
356
|
+
</pnx-quality-score>
|
|
357
|
+
</div>
|
|
358
|
+
</div>
|
|
359
|
+
` : nothing}
|
|
360
|
+
|
|
361
|
+
${this["user-search"] ? html`
|
|
362
|
+
<div class="pnx-filter-block">
|
|
363
|
+
<h4>${fa(faUser)} ${this._parent?._t.pnx.filter_user}</h4>
|
|
364
|
+
${userAccount ? html`
|
|
365
|
+
<div class="pnx-input-shortcuts">
|
|
366
|
+
<button>${this._parent?._t.pnx.filter_user_mypics}</button>
|
|
367
|
+
</div>
|
|
368
|
+
` : nothing}
|
|
369
|
+
<pnx-search-bar
|
|
370
|
+
id="pnx-filter-search-user"
|
|
371
|
+
placeholder=${this._parent?._t.pnx.search_user}
|
|
372
|
+
class=${this.user ? "pnx-filter-active" : ""}
|
|
373
|
+
value=${this.user}
|
|
374
|
+
@result=${this._onUserSearchResult}
|
|
375
|
+
.searcher=${this._userSearch.bind(this)}
|
|
376
|
+
._parent=${this._parent}
|
|
377
|
+
no-menu-closure
|
|
378
|
+
>
|
|
379
|
+
</pnx-search-bar>
|
|
380
|
+
</div>
|
|
381
|
+
` : nothing}
|
|
382
|
+
</form>`;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
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="outline"
|
|
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,54 @@
|
|
|
1
|
+
import {LitElement, html, nothing, css} from "lit";
|
|
2
|
+
import { fa } from "../../utils/widgets";
|
|
3
|
+
import { faInfoCircle } from "@fortawesome/free-solid-svg-icons/faInfoCircle";
|
|
4
|
+
import PanoramaxImg from "../../img/panoramax.svg";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Map legend displays information about map sources and Panoramax.
|
|
8
|
+
* @class Panoramax.components.menus.MapLegend
|
|
9
|
+
* @element pnx-map-legend
|
|
10
|
+
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <pnx-map-legend ._parent=${viewer} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export default class MapLegend extends LitElement {
|
|
17
|
+
/** @private */
|
|
18
|
+
static styles = css`
|
|
19
|
+
:host {
|
|
20
|
+
font-size: 0.8em;
|
|
21
|
+
}
|
|
22
|
+
small {
|
|
23
|
+
font-size: 1em;
|
|
24
|
+
}
|
|
25
|
+
.presentation {
|
|
26
|
+
display: flex;
|
|
27
|
+
gap: 5px;
|
|
28
|
+
align-items: center;
|
|
29
|
+
}
|
|
30
|
+
.logo {
|
|
31
|
+
width: 45px;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
/** @private */
|
|
36
|
+
render() {
|
|
37
|
+
const mapAttrib = this._parent?.map?._attribution?._innerContainer;
|
|
38
|
+
|
|
39
|
+
return html`
|
|
40
|
+
<div class="presentation">
|
|
41
|
+
<img class="logo" src=${PanoramaxImg} alt="" />
|
|
42
|
+
<div>
|
|
43
|
+
Panoramax est le géocommun des photos de rues.
|
|
44
|
+
<pnx-link-button title=${this._parent?._t.map.more_panoramax} kind="outline" href="https://panoramax.fr" target="_blank">
|
|
45
|
+
${fa(faInfoCircle, { styles: {height: "12px", "margin-inline": "3px"}})}
|
|
46
|
+
</pnx-link-button>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
${mapAttrib ? html`${this._parent?._t.map.map_data}<br />${mapAttrib}` : nothing}
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
customElements.define("pnx-map-legend", MapLegend);
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {LitElement, html, nothing, css} from "lit";
|
|
2
|
+
import {fa} from "../../utils/widgets";
|
|
3
|
+
import { faCircleInfo } from "@fortawesome/free-solid-svg-icons/faCircleInfo";
|
|
4
|
+
import { placeholder } from "../styles";
|
|
5
|
+
import { reverseGeocodingNominatim } from "../../utils/geocoder";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Picture legend shows info about picture author, capture date, address, and access to metadata popup.
|
|
9
|
+
* @class Panoramax.components.menus.PictureLegend
|
|
10
|
+
* @element pnx-picture-legend
|
|
11
|
+
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <pnx-picture-legend ._parent=${viewer} />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export default class PictureLegend extends LitElement {
|
|
18
|
+
/** @private */
|
|
19
|
+
static styles = [placeholder, css`
|
|
20
|
+
.addr {
|
|
21
|
+
line-height: 1.2em;
|
|
22
|
+
font-size: 1em;
|
|
23
|
+
margin-bottom: 2px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.addr span {
|
|
27
|
+
display: inline-block;
|
|
28
|
+
height: 100%;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.context {
|
|
33
|
+
font-size: 0.8em;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: space-between;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
pnx-button { float: right; vertical-align: sub; }
|
|
40
|
+
`];
|
|
41
|
+
|
|
42
|
+
/** @private */
|
|
43
|
+
static properties = {
|
|
44
|
+
_caption: { state: true },
|
|
45
|
+
_addr: { state: true },
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** @private */
|
|
49
|
+
connectedCallback() {
|
|
50
|
+
super.connectedCallback();
|
|
51
|
+
|
|
52
|
+
this._parent.onceReady().then(() => {
|
|
53
|
+
this._onPicChange(this._parent.psv.getPictureMetadata());
|
|
54
|
+
this._parent.psv.addEventListener("picture-loaded", () => {
|
|
55
|
+
this._onPicChange(this._parent.psv.getPictureMetadata());
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** @private */
|
|
61
|
+
_onPicChange(picMeta) {
|
|
62
|
+
clearTimeout(this._addrTimer1);
|
|
63
|
+
this._caption = picMeta?.caption;
|
|
64
|
+
|
|
65
|
+
if(picMeta) {
|
|
66
|
+
this._addrTimer1 = setTimeout(() => {
|
|
67
|
+
this._addrTimer2 = setTimeout(() => this._addr = "", 500);
|
|
68
|
+
|
|
69
|
+
reverseGeocodingNominatim(picMeta.gps[1], picMeta.gps[0])
|
|
70
|
+
.then(addr => {
|
|
71
|
+
clearTimeout(this._addrTimer2);
|
|
72
|
+
this._addr = addr;
|
|
73
|
+
});
|
|
74
|
+
}, 500);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this._addr = "";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** @private */
|
|
82
|
+
render() {
|
|
83
|
+
if(!this._caption) { return nothing; }
|
|
84
|
+
|
|
85
|
+
return html`
|
|
86
|
+
<div class="addr">
|
|
87
|
+
${this._addr?.length > 0 ? this._addr : html`<span class="pnx-placeholder-loading"> </span>`}
|
|
88
|
+
</div>
|
|
89
|
+
<div class="context">
|
|
90
|
+
${this._caption.producer ? this._caption.producer : nothing}
|
|
91
|
+
${this._caption.producer && this._caption.date ? html`-` : nothing}
|
|
92
|
+
${this._caption.date ? this._caption.date.toLocaleDateString(undefined, { year: "numeric", month: "long", day: "numeric" }) : nothing}
|
|
93
|
+
<pnx-button
|
|
94
|
+
kind="outline"
|
|
95
|
+
title=${this._parent?._t.pnx.legend_title}
|
|
96
|
+
@click=${() => this._parent?._showPictureMetadata()}
|
|
97
|
+
>${fa(faCircleInfo, { styles: { height: "12px" }})}</pnx-button>
|
|
98
|
+
</div>
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
customElements.define("pnx-picture-legend", PictureLegend);
|