@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,13 @@
|
|
|
1
|
+
/* eslint-disable import/no-unused-modules */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Graphical components
|
|
5
|
+
* @module Panoramax:components
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as core from "./core";
|
|
9
|
+
import * as layout from "./layout";
|
|
10
|
+
import * as menus from "./menus";
|
|
11
|
+
import * as ui from "./ui";
|
|
12
|
+
|
|
13
|
+
export {core, layout, menus, ui};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CorneredGrid layout offers a convenient way to display overlay widgets on top of a background component.
|
|
5
|
+
* This is useful for showing buttons in corners over a map or picture display.
|
|
6
|
+
* Grid layout is organised through many slots (background and corners) : two rows (top, bottom) and three columns (right, middle, left).
|
|
7
|
+
* @class Panoramax.components.layout.CorneredGrid
|
|
8
|
+
* @element pnx-cornered-grid
|
|
9
|
+
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
|
|
10
|
+
* @slot `bg` The full size background component
|
|
11
|
+
* @slot `top-left` The top-left corner
|
|
12
|
+
* @slot `top` The top middle corner
|
|
13
|
+
* @slot `top-right` The top-right corner
|
|
14
|
+
* @slot `bottom-left` The bottom-left corner
|
|
15
|
+
* @slot `bottom` The bottom middle corner
|
|
16
|
+
* @slot `bottom-right` The bottom-right corner
|
|
17
|
+
* @example
|
|
18
|
+
* ```html
|
|
19
|
+
* <pnx-cornered-grid>
|
|
20
|
+
* <pnx-map slot="bg" />
|
|
21
|
+
* <pnx-button slot="top-left" />
|
|
22
|
+
* <pnx-button slot="top-left" />
|
|
23
|
+
* <pnx-legend slot="bottom" />
|
|
24
|
+
* </pnx-cornered-grid>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export default class CorneredGrid extends LitElement {
|
|
28
|
+
/** @private */
|
|
29
|
+
static styles = css`
|
|
30
|
+
:host {
|
|
31
|
+
position: relative;
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
gap: 5px;
|
|
37
|
+
flex-wrap: no-wrap;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.bg {
|
|
41
|
+
position: absolute;
|
|
42
|
+
inset: 0;
|
|
43
|
+
z-index: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.row {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
flex: 1 1 50%;
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.corner {
|
|
54
|
+
position: relative;
|
|
55
|
+
flex: 1 1 33%;
|
|
56
|
+
display: flex;
|
|
57
|
+
gap: 10px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.corner slot {
|
|
61
|
+
pointer-events: auto;
|
|
62
|
+
position: relative;
|
|
63
|
+
z-index: 120;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.row.bottom .corner:not(.middle) { flex-direction: column; }
|
|
67
|
+
.row.bottom .corner.left { justify-content: flex-end; align-items: flex-start; }
|
|
68
|
+
.row.bottom .corner.middle { justify-content: center; align-items: flex-end; }
|
|
69
|
+
.row.bottom .corner.right { justify-content: flex-end; align-items: flex-end; }
|
|
70
|
+
|
|
71
|
+
.row.top .corner { flex-direction: row; }
|
|
72
|
+
.row.top .corner.left { justify-content: flex-start; align-items: flex-start; }
|
|
73
|
+
.row.top .corner.middle { justify-content: center; }
|
|
74
|
+
.row.top .corner.right { justify-content: flex-end; align-items: flex-start; }
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
/** @private */
|
|
78
|
+
render() {
|
|
79
|
+
return html`
|
|
80
|
+
<div class="bg">
|
|
81
|
+
<slot name="bg"></slot>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="row top">
|
|
84
|
+
<div class="corner left" part="corner-top-left">
|
|
85
|
+
<slot name="top-left"></slot>
|
|
86
|
+
</div>
|
|
87
|
+
<div class="corner middle" part="corner-top">
|
|
88
|
+
<slot name="top"></slot>
|
|
89
|
+
</div>
|
|
90
|
+
<div class="corner right" part="corner-top-right">
|
|
91
|
+
<slot name="top-right"></slot>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="row bottom">
|
|
95
|
+
<div class="corner left" part="corner-bottom-left">
|
|
96
|
+
<slot name="bottom-left"></slot>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="corner middle" part="corner-bottom">
|
|
99
|
+
<slot name="bottom"></slot>
|
|
100
|
+
</div>
|
|
101
|
+
<div class="corner right" part="corner-bottom-right">
|
|
102
|
+
<slot name="bottom-right"></slot>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
customElements.define("pnx-cornered-grid", CorneredGrid);
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import SwitchBig from "../../img/switch_big.svg";
|
|
3
|
+
import SwitchMini from "../../img/switch_mini.svg";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Mini layout allows to show a reduced or collapsed component in a corner of a main component.
|
|
7
|
+
* For example, show a reduced map on top of a photo display.
|
|
8
|
+
* @class Panoramax.components.layout.Mini
|
|
9
|
+
* @element pnx-mini
|
|
10
|
+
* @slot `default` The component to display.
|
|
11
|
+
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
|
|
12
|
+
* @fires Panoramax.components.layout.Mini#expand
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <pnx-mini icon=${fa(faMap)} ._parent=${viewer}>
|
|
16
|
+
* <pnx-map />
|
|
17
|
+
* </pnx-mini>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export default class Mini extends LitElement {
|
|
21
|
+
/** @private */
|
|
22
|
+
static styles = css`
|
|
23
|
+
:host {
|
|
24
|
+
display: block;
|
|
25
|
+
position: absolute;
|
|
26
|
+
inset: 0;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
slot {
|
|
31
|
+
z-index: 120;
|
|
32
|
+
pointer-events: auto;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
pnx-button {
|
|
36
|
+
z-index: 121;
|
|
37
|
+
position: absolute;
|
|
38
|
+
pointer-events: auto;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
pnx-button img {
|
|
42
|
+
height: 20px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
pnx-button:not([size="xxl"])::part(btn) {
|
|
46
|
+
border-top-left-radius: 0;
|
|
47
|
+
border-bottom-right-radius: 0;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Component properties.
|
|
53
|
+
* @memberof Panoramax.components.layout.Mini#
|
|
54
|
+
* @type {Object}
|
|
55
|
+
* @property {string} [icon] The icon to use in collapsed button.
|
|
56
|
+
* @property {boolean} [collapsed=false] Collapsed displays only a simple button.
|
|
57
|
+
*/
|
|
58
|
+
static properties = {
|
|
59
|
+
icon: {type: String},
|
|
60
|
+
collapsed: {type: Boolean, reflect: true},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
constructor() {
|
|
64
|
+
super();
|
|
65
|
+
|
|
66
|
+
this.collapsed = false;
|
|
67
|
+
this.icon = null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** @private */
|
|
71
|
+
render() {
|
|
72
|
+
const isSmall = this._parent?.isWidthSmall() || this._parent?.isHeightSmall();
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Event when user ask for component expand
|
|
76
|
+
* @event Panoramax.components.layout.Mini#expand
|
|
77
|
+
* @type {Event}
|
|
78
|
+
*/
|
|
79
|
+
const onExpand = () => this.dispatchEvent(new Event("expand", {bubbles: true, composed: true}));
|
|
80
|
+
|
|
81
|
+
if(this.collapsed || isSmall) {
|
|
82
|
+
const click = isSmall ? onExpand : () => this.collapsed = false;
|
|
83
|
+
return html`<pnx-button
|
|
84
|
+
kind="flat"
|
|
85
|
+
size="xxl"
|
|
86
|
+
style="bottom: 0"
|
|
87
|
+
@click=${click}
|
|
88
|
+
>${this.icon}</pnx-button>`;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return html`
|
|
92
|
+
<slot></slot>
|
|
93
|
+
|
|
94
|
+
<pnx-button
|
|
95
|
+
kind="superflat"
|
|
96
|
+
title=${this._parent?._t.pnx.expand_info}
|
|
97
|
+
style="top: 0; right: 0"
|
|
98
|
+
@click=${onExpand}
|
|
99
|
+
>
|
|
100
|
+
<img src=${SwitchBig} alt="" />
|
|
101
|
+
${this._parent?._t.pnx.expand}
|
|
102
|
+
</pnx-button>
|
|
103
|
+
|
|
104
|
+
<pnx-button
|
|
105
|
+
kind="flat"
|
|
106
|
+
title=${this._parent?._t.pnx.minimize}
|
|
107
|
+
style="bottom: 0; left: 0"
|
|
108
|
+
@click=${() => this.collapsed = true}
|
|
109
|
+
>
|
|
110
|
+
<img src=${SwitchMini} alt="" />
|
|
111
|
+
</pnx-button>
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
customElements.define("pnx-mini", Mini);
|
|
@@ -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);
|