@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.
- package/.gitlab-ci.yml +13 -6
- package/CHANGELOG.md +53 -1
- package/CODE_OF_CONDUCT.md +1 -1
- package/README.md +1 -1
- package/build/editor.html +10 -1
- package/build/index.css +12 -12
- package/build/index.css.map +1 -1
- package/build/index.html +1 -1
- package/build/index.js +2126 -14
- package/build/index.js.map +1 -1
- package/build/map.html +1 -1
- package/build/photo.html +1 -0
- package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff +0 -0
- package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff2 +0 -0
- package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff +0 -0
- package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff2 +0 -0
- package/build/viewer.html +12 -1
- package/build/widgets.html +1 -0
- package/config/jest/mocks.js +201 -0
- package/config/paths.js +2 -0
- package/config/webpack.config.js +52 -0
- package/docs/03_URL_settings.md +14 -16
- package/docs/05_Compatibility.md +59 -76
- package/docs/09_Develop.md +46 -11
- package/docs/90_Releases.md +2 -2
- package/docs/images/class_diagram.drawio +60 -45
- package/docs/images/class_diagram.jpg +0 -0
- package/docs/images/screenshot.jpg +0 -0
- package/docs/index.md +135 -0
- package/docs/reference/components/core/Basic.md +196 -0
- package/docs/reference/components/core/CoverageMap.md +210 -0
- package/docs/reference/components/core/Editor.md +224 -0
- package/docs/reference/components/core/PhotoViewer.md +307 -0
- package/docs/reference/components/core/Viewer.md +350 -0
- package/docs/reference/components/layout/BottomDrawer.md +35 -0
- package/docs/reference/components/layout/CorneredGrid.md +29 -0
- package/docs/reference/components/layout/Mini.md +45 -0
- package/docs/reference/components/layout/Tabs.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 +16 -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 +40 -0
- package/docs/reference/components/ui/ButtonGroup.md +36 -0
- package/docs/reference/components/ui/CopyButton.md +38 -0
- package/docs/reference/components/ui/Grade.md +32 -0
- package/docs/reference/components/ui/LinkButton.md +45 -0
- package/docs/reference/components/ui/ListGroup.md +22 -0
- package/docs/reference/components/ui/Loader.md +56 -0
- package/docs/reference/components/ui/Map.md +239 -0
- package/docs/reference/components/ui/MapMore.md +256 -0
- package/docs/reference/components/ui/Photo.md +385 -0
- package/docs/reference/components/ui/Popup.md +56 -0
- package/docs/reference/components/ui/ProgressBar.md +32 -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 +49 -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/OSMEditors.md +15 -0
- package/docs/reference/components/ui/widgets/PictureLegendActions.md +32 -0
- package/docs/reference/components/ui/widgets/Player.md +33 -0
- package/docs/reference/components/ui/widgets/Zoom.md +15 -0
- package/docs/reference/utils/API.md +334 -0
- package/docs/reference/utils/InitParameters.md +68 -0
- package/docs/reference/utils/URLHandler.md +107 -0
- package/docs/reference.md +79 -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 +59 -0
- package/docs/tutorials/map_style.md +39 -0
- package/docs/tutorials/migrate_v4.md +153 -0
- package/docs/tutorials/synced_coverage.md +43 -0
- package/mkdocs.yml +66 -5
- package/package.json +22 -17
- package/public/editor.html +21 -29
- package/public/index.html +17 -12
- package/public/map.html +19 -18
- package/public/photo.html +55 -0
- package/public/viewer.html +22 -26
- package/public/widgets.html +306 -0
- package/scripts/doc.js +79 -0
- package/src/components/core/Basic.css +48 -0
- package/src/components/core/Basic.js +349 -0
- package/src/components/core/CoverageMap.css +9 -0
- package/src/components/core/CoverageMap.js +139 -0
- package/src/components/core/Editor.css +23 -0
- package/src/components/core/Editor.js +390 -0
- package/src/components/core/PhotoViewer.css +48 -0
- package/src/components/core/PhotoViewer.js +499 -0
- package/src/components/core/Viewer.css +98 -0
- package/src/components/core/Viewer.js +564 -0
- package/src/components/core/index.js +12 -0
- package/src/components/index.js +13 -0
- package/src/components/layout/BottomDrawer.js +257 -0
- package/src/components/layout/CorneredGrid.js +112 -0
- package/src/components/layout/Mini.js +117 -0
- package/src/components/layout/Tabs.js +133 -0
- package/src/components/layout/index.js +9 -0
- package/src/components/menus/MapBackground.js +106 -0
- package/src/components/menus/MapFilters.js +400 -0
- package/src/components/menus/MapLayers.js +143 -0
- package/src/components/menus/MapLegend.js +34 -0
- package/src/components/menus/PictureLegend.js +257 -0
- package/src/components/menus/PictureMetadata.js +317 -0
- package/src/components/menus/PlayerOptions.js +95 -0
- package/src/components/menus/QualityScoreDoc.js +36 -0
- package/src/components/menus/ReportForm.js +133 -0
- package/src/components/menus/Share.js +100 -0
- package/src/components/menus/index.js +15 -0
- package/src/components/styles.js +383 -0
- package/src/components/ui/Button.js +77 -0
- package/src/components/ui/ButtonGroup.css +57 -0
- package/src/components/ui/ButtonGroup.js +68 -0
- package/src/components/ui/CopyButton.js +106 -0
- package/src/components/ui/Grade.js +54 -0
- package/src/components/ui/LinkButton.js +67 -0
- package/src/components/ui/ListGroup.js +66 -0
- package/src/components/ui/Loader.js +203 -0
- package/src/components/{Map.css → ui/Map.css} +5 -17
- package/src/components/{Map.js → ui/Map.js} +148 -156
- 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} +313 -101
- package/src/components/ui/Popup.js +145 -0
- package/src/components/ui/ProgressBar.js +104 -0
- package/src/components/ui/QualityScore.js +147 -0
- package/src/components/ui/SearchBar.js +367 -0
- package/src/components/ui/TogglableGroup.js +157 -0
- package/src/components/ui/index.js +22 -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 +113 -0
- package/src/components/ui/widgets/MapFiltersButton.js +104 -0
- package/src/components/ui/widgets/MapLayersButton.js +79 -0
- package/src/components/ui/widgets/OSMEditors.js +155 -0
- package/src/components/ui/widgets/PictureLegendActions.js +117 -0
- package/src/components/ui/widgets/Player.css +7 -0
- package/src/components/ui/widgets/Player.js +151 -0
- package/src/components/ui/widgets/Zoom.js +82 -0
- package/src/components/ui/widgets/index.js +13 -0
- package/src/img/loader_base.jpg +0 -0
- package/src/img/panoramax.svg +13 -0
- package/src/img/switch_big.svg +20 -10
- package/src/index.js +7 -9
- package/src/translations/br.json +1 -0
- package/src/translations/da.json +38 -15
- package/src/translations/de.json +5 -3
- package/src/translations/en.json +35 -15
- package/src/translations/eo.json +38 -15
- package/src/translations/es.json +1 -1
- package/src/translations/fr.json +36 -16
- package/src/translations/hu.json +1 -1
- package/src/translations/it.json +39 -16
- package/src/translations/ja.json +182 -1
- package/src/translations/nl.json +106 -6
- package/src/translations/pl.json +1 -1
- package/src/translations/sv.json +182 -0
- package/src/translations/zh_Hant.json +35 -14
- package/src/utils/API.js +109 -49
- package/src/utils/InitParameters.js +388 -0
- package/src/utils/PhotoAdapter.js +1 -0
- package/src/utils/URLHandler.js +362 -0
- package/src/utils/geocoder.js +152 -0
- package/src/utils/{I18n.js → i18n.js} +7 -3
- package/src/utils/index.js +11 -0
- package/src/utils/{Map.js → map.js} +256 -77
- package/src/utils/picture.js +442 -0
- package/src/utils/utils.js +324 -0
- package/src/utils/widgets.js +55 -0
- package/tests/components/core/Basic.test.js +121 -0
- package/tests/components/core/BasicMock.js +25 -0
- package/tests/components/core/CoverageMap.test.js +20 -0
- package/tests/components/core/Editor.test.js +20 -0
- package/tests/components/core/PhotoViewer.test.js +57 -0
- package/tests/components/core/Viewer.test.js +84 -0
- package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +73 -0
- package/tests/components/core/__snapshots__/Viewer.test.js.snap +145 -0
- package/tests/components/ui/CopyButton.test.js +52 -0
- package/tests/components/ui/Loader.test.js +55 -0
- package/tests/components/{Map.test.js → ui/Map.test.js} +73 -61
- package/tests/components/{Photo.test.js → ui/Photo.test.js} +97 -63
- package/tests/components/ui/Popup.test.js +26 -0
- package/tests/components/ui/QualityScore.test.js +18 -0
- package/tests/components/ui/SearchBar.test.js +110 -0
- package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +33 -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 +70 -6
- 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 +83 -83
- package/tests/utils/InitParameters.test.js +499 -0
- package/tests/utils/URLHandler.test.js +401 -0
- package/tests/utils/__snapshots__/API.test.js.snap +10 -0
- package/tests/utils/__snapshots__/URLHandler.test.js.snap +21 -0
- package/tests/utils/__snapshots__/{Map.test.js.snap → geocoder.test.js.snap} +1 -1
- package/tests/utils/__snapshots__/map.test.js.snap +11 -0
- package/tests/utils/__snapshots__/picture.test.js.snap +327 -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} +8 -8
- package/tests/utils/map.test.js +126 -0
- package/tests/utils/picture.test.js +745 -0
- package/tests/utils/utils.test.js +288 -0
- package/tests/utils/widgets.test.js +31 -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/img/loader_hd.jpg +0 -0
- 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
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { fa } from "../../utils/widgets";
|
|
3
|
+
import { panel, faSvg } from "../styles";
|
|
4
|
+
import { faXmark } from "@fortawesome/free-solid-svg-icons/faXmark";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Popup Element displays a full overlay container.
|
|
8
|
+
* @class Panoramax.components.ui.Popup
|
|
9
|
+
* @element pnx-popup
|
|
10
|
+
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
|
|
11
|
+
* @fires Panoramax.components.ui.Popup#open
|
|
12
|
+
* @fires Panoramax.components.ui.Popup#close
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <pnx-popup @close=${() => alert("closed")}>
|
|
16
|
+
* <h3>Popup content</h3>
|
|
17
|
+
* </pnx-popup>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export default class Popup extends LitElement {
|
|
21
|
+
/** @private */
|
|
22
|
+
static styles = [ panel, faSvg, css`
|
|
23
|
+
/* Backdrop */
|
|
24
|
+
:host {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
position: absolute;
|
|
29
|
+
top: 0;
|
|
30
|
+
right: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
bottom: 0;
|
|
33
|
+
opacity: 0;
|
|
34
|
+
visibility: hidden;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
transition: all 0.2s;
|
|
37
|
+
background: rgba(0, 0, 0, 0.85);
|
|
38
|
+
}
|
|
39
|
+
:host(*[visible]) {
|
|
40
|
+
opacity: 1;
|
|
41
|
+
visibility: visible;
|
|
42
|
+
pointer-events: unset;
|
|
43
|
+
z-index: 200;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Content backgroud */
|
|
47
|
+
.pnx-panel {
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
position: relative;
|
|
50
|
+
width: 90%;
|
|
51
|
+
max-height: 90%;
|
|
52
|
+
max-width: 550px;
|
|
53
|
+
overflow-y: auto;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.btn-close {
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 15px;
|
|
59
|
+
right: 15px;
|
|
60
|
+
}
|
|
61
|
+
`];
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Component properties.
|
|
65
|
+
* @memberof Panoramax.components.ui.Popup#
|
|
66
|
+
* @type {Object}
|
|
67
|
+
* @property {boolean} [visible=true] Is the popup visible to user ?
|
|
68
|
+
*/
|
|
69
|
+
static properties = {
|
|
70
|
+
visible: {type: Boolean, reflect: true},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
constructor() {
|
|
74
|
+
super();
|
|
75
|
+
this.visible = false;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** @private */
|
|
79
|
+
connectedCallback() {
|
|
80
|
+
super.connectedCallback();
|
|
81
|
+
|
|
82
|
+
// Backdrop closing
|
|
83
|
+
this.addEventListener("click", e => {
|
|
84
|
+
if(e.target === this) { this.close(); }
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Esc closing
|
|
88
|
+
document.addEventListener("keyup", e => {
|
|
89
|
+
if(e.key === "Escape" && this.visible) {
|
|
90
|
+
this.close();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** @private */
|
|
96
|
+
attributeChangedCallback(name, _old, value) {
|
|
97
|
+
super.attributeChangedCallback(name, _old, value);
|
|
98
|
+
|
|
99
|
+
if(name == "visible") {
|
|
100
|
+
if(value === "" || value === true) {
|
|
101
|
+
/**
|
|
102
|
+
* Event for popup opening
|
|
103
|
+
* @event Panoramax.components.ui.Popup#open
|
|
104
|
+
* @type {Event}
|
|
105
|
+
*/
|
|
106
|
+
this.dispatchEvent(new Event("open"));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Close popup
|
|
113
|
+
* @memberof Panoramax.components.ui.Popup#
|
|
114
|
+
*/
|
|
115
|
+
close() {
|
|
116
|
+
this.visible = false;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Event for popup closing
|
|
120
|
+
* @event Panoramax.components.ui.Popup#close
|
|
121
|
+
* @type {Event}
|
|
122
|
+
*/
|
|
123
|
+
this.dispatchEvent(new Event("close"));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** @private */
|
|
127
|
+
render() {
|
|
128
|
+
return html`
|
|
129
|
+
<div class="pnx-panel pnx-padded">
|
|
130
|
+
<pnx-button
|
|
131
|
+
class="btn-close"
|
|
132
|
+
kind="flat"
|
|
133
|
+
size="l"
|
|
134
|
+
@click=${this.close.bind(this)}
|
|
135
|
+
>
|
|
136
|
+
${fa(faXmark)}
|
|
137
|
+
</pnx-button>
|
|
138
|
+
|
|
139
|
+
<slot></slot>
|
|
140
|
+
</div>
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
customElements.define("pnx-popup", Popup);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Progress bar with nice styling.
|
|
5
|
+
* @class Panoramax.components.ui.ProgressBar
|
|
6
|
+
* @element pnx-progress-bar
|
|
7
|
+
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
|
|
8
|
+
* @example
|
|
9
|
+
* ```html
|
|
10
|
+
* <pnx-loader value="42" ._t=${viewer._t} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export default class ProgressBar extends LitElement {
|
|
14
|
+
/** @private */
|
|
15
|
+
static styles = css`
|
|
16
|
+
progress {
|
|
17
|
+
max-width: 80vh;
|
|
18
|
+
width: 300px;
|
|
19
|
+
height: 16px;
|
|
20
|
+
appearance: none;
|
|
21
|
+
-webkit-appearance: none;
|
|
22
|
+
border: 1px solid var(--grey-semi-dark);
|
|
23
|
+
background-color: var(--grey);
|
|
24
|
+
border-radius: 8px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
padding: 3px;
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
display: block;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
progress::-webkit-progress-bar {
|
|
32
|
+
background-color: var(--grey);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Don't merge with -moz below, for some f*ing reason a list selector doesn't work with Chrome */
|
|
36
|
+
progress::-webkit-progress-value {
|
|
37
|
+
background-color: var(--blue);
|
|
38
|
+
border-radius: 5px;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
progress::-moz-progress-bar {
|
|
43
|
+
background-color: var(--blue);
|
|
44
|
+
border-radius: 5px;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
progress[value=""]::-moz-progress-bar,
|
|
49
|
+
progress:not([value])::-moz-progress-bar {
|
|
50
|
+
animation: indeterminateAnimation 1.5s infinite linear;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
progress.indeterminate {
|
|
54
|
+
position: relative;
|
|
55
|
+
background-color: var(--grey);
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
progress.indeterminate::after {
|
|
60
|
+
content: "";
|
|
61
|
+
position: absolute;
|
|
62
|
+
left: 3px;
|
|
63
|
+
top: 3px;
|
|
64
|
+
bottom: 3px;
|
|
65
|
+
width: 20%;
|
|
66
|
+
background-color: var(--blue);
|
|
67
|
+
border-radius: 5px;
|
|
68
|
+
animation: indeterminateAnimation 1.5s infinite linear;
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@keyframes indeterminateAnimation {
|
|
73
|
+
0% { margin-left: 0%; width: 2%; }
|
|
74
|
+
15% { margin-left: 0%; width: 20%; }
|
|
75
|
+
50% { margin-left: 40%; width: 20%; }
|
|
76
|
+
85% { margin-left: 80%; width: 20%; }
|
|
77
|
+
100% { margin-left: 98%; width: 2%; }
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Component properties.
|
|
83
|
+
* @memberof Panoramax.components.ui.ProgressBar#
|
|
84
|
+
* @type {Object}
|
|
85
|
+
* @property {number} [value] Progress bar percentage (0-100) or empty for indeterminate state
|
|
86
|
+
*/
|
|
87
|
+
static properties = {
|
|
88
|
+
value: {type: Number},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** @private */
|
|
92
|
+
render() {
|
|
93
|
+
return html`
|
|
94
|
+
<progress
|
|
95
|
+
value=${this.value >= 0 ? this.value : nothing}
|
|
96
|
+
class=${this.value >= 0 ? nothing : "indeterminate"}
|
|
97
|
+
max="100"
|
|
98
|
+
title=${this._t?.map.loading}
|
|
99
|
+
></progress>
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
customElements.define("pnx-progress-bar", ProgressBar);
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { QUALITYSCORE_VALUES } from "../../utils/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Quality Score element displays the picture quality grade.
|
|
6
|
+
* @class Panoramax.components.ui.QualityScore
|
|
7
|
+
* @element pnx-quality-score
|
|
8
|
+
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
|
|
9
|
+
* @fires Panoramax.components.ui.QualityScore#change
|
|
10
|
+
* @example
|
|
11
|
+
* ```html
|
|
12
|
+
* <!-- Read-only -->
|
|
13
|
+
* <pnx-quality-score grade="5" ._t=${viewer._t} />
|
|
14
|
+
*
|
|
15
|
+
* <!-- Input -->
|
|
16
|
+
* <pnx-quality-score grade="5" input="pnx-qs-input" @change=${() => alert('changed')} ._t=${viewer._t} />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export default class QualityScore extends LitElement {
|
|
20
|
+
/** @private */
|
|
21
|
+
static styles = css`
|
|
22
|
+
:host {
|
|
23
|
+
gap: 0px;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
height: 2em;
|
|
26
|
+
font-size: 18px;
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
color: white;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Single letter */
|
|
33
|
+
span, label {
|
|
34
|
+
width: 1.2em;
|
|
35
|
+
height: 1.5em;
|
|
36
|
+
line-height: 1.5em;
|
|
37
|
+
display: inline-block;
|
|
38
|
+
border: 0.05em solid white;
|
|
39
|
+
text-align: center;
|
|
40
|
+
background-color: gray;
|
|
41
|
+
color: rgba(255,255,255,0.9);
|
|
42
|
+
font-family: var(--font-family);
|
|
43
|
+
font-weight: 800;
|
|
44
|
+
vertical-align: middle;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Rounded corners for first/last */
|
|
48
|
+
span:first-of-type, label:first-of-type {
|
|
49
|
+
border-top-left-radius: 0.4em;
|
|
50
|
+
border-bottom-left-radius: 0.4em;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
span:last-of-type, label:last-of-type {
|
|
54
|
+
border-top-right-radius: 0.4em;
|
|
55
|
+
border-bottom-right-radius: 0.4em;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Selected letter */
|
|
59
|
+
.selected, input[type="checkbox"]:checked + label {
|
|
60
|
+
font-size: 1.3em;
|
|
61
|
+
height: 1.6em;
|
|
62
|
+
line-height: 1.6em;
|
|
63
|
+
border-radius: 0.3em !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Clickable letter for input */
|
|
67
|
+
label { cursor: pointer; }
|
|
68
|
+
|
|
69
|
+
label:hover {
|
|
70
|
+
font-size: 1.2em;
|
|
71
|
+
height: 1.6em;
|
|
72
|
+
line-height: 1.6em;
|
|
73
|
+
border-radius: 0.3em !important;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
input[type="checkbox"] { display: none; }
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Component properties.
|
|
81
|
+
* @memberof Panoramax.components.ui.QualityScore#
|
|
82
|
+
* @type {Object}
|
|
83
|
+
* @property {number|string} [grade=0] The grade (5=A, 1=E, 0=none selected), or a list of grades
|
|
84
|
+
* @property {string} [input=false] If set, score is an input and value is used as ID prefix
|
|
85
|
+
*/
|
|
86
|
+
static properties = {
|
|
87
|
+
grade: {type: String},
|
|
88
|
+
input: {type: String},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
constructor() {
|
|
92
|
+
super();
|
|
93
|
+
this.grade = 0;
|
|
94
|
+
this.input = false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** @private */
|
|
98
|
+
_onInput() {
|
|
99
|
+
// List all checked boxes
|
|
100
|
+
const newgrade = [];
|
|
101
|
+
for(let i of this.renderRoot.querySelectorAll("input")) {
|
|
102
|
+
if(i.checked) { newgrade.push(i.value); }
|
|
103
|
+
}
|
|
104
|
+
this.grade = newgrade.join(",");
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Event for grade change
|
|
108
|
+
* @event Panoramax.components.ui.QualityScore#change
|
|
109
|
+
* @type {CustomEvent}
|
|
110
|
+
*/
|
|
111
|
+
this.dispatchEvent(new CustomEvent("change", {bubbles: true, composed: true}));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** @private */
|
|
115
|
+
render() {
|
|
116
|
+
const grades = `${this.grade}`.split(",").map(v => parseInt(v)).filter(v => !isNaN(v));
|
|
117
|
+
if(this.input) {
|
|
118
|
+
return QUALITYSCORE_VALUES.map((pv, index) => {
|
|
119
|
+
return html`
|
|
120
|
+
<input
|
|
121
|
+
id="${this.input}-${pv.label}"
|
|
122
|
+
type="checkbox"
|
|
123
|
+
name="qualityscore"
|
|
124
|
+
value="${5-index}"
|
|
125
|
+
@change="${this._onInput}"
|
|
126
|
+
.checked=${grades.includes(5-index)}
|
|
127
|
+
/>
|
|
128
|
+
<label
|
|
129
|
+
for="${this.input}-${pv.label}"
|
|
130
|
+
title="${this._t?.pnx.filter_qualityscore_help}"
|
|
131
|
+
style="background-color: ${pv.color}"
|
|
132
|
+
>
|
|
133
|
+
${pv.label}
|
|
134
|
+
</label>
|
|
135
|
+
`;});
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return QUALITYSCORE_VALUES.map((pv, index) => html`
|
|
139
|
+
<span class="${grades.includes(5-index) ? "selected" : ""}" style="background-color: ${pv.color}">
|
|
140
|
+
${pv.label}
|
|
141
|
+
</span>
|
|
142
|
+
`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
customElements.define("pnx-quality-score", QualityScore);
|