@panoramax/web-viewer 4.0.3-develop-d48b09a7 → 4.0.3-develop-90cc79b9
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/CHANGELOG.md +3 -1
- package/build/index.css +1 -1
- package/build/index.css.map +1 -1
- package/build/index.js +160 -72
- package/build/index.js.map +1 -1
- package/docs/reference/components/menus/MapLegend.md +17 -0
- package/docs/reference/components/menus/PictureLegend.md +17 -0
- package/docs/reference/components/ui/AnnotationsSwitch.md +15 -0
- package/docs/reference/components/ui/widgets/Legend.md +5 -4
- package/docs/reference.md +1 -1
- package/mkdocs.yml +1 -1
- package/package.json +1 -1
- package/src/components/core/PhotoViewer.js +28 -15
- package/src/components/core/Viewer.css +0 -1
- package/src/components/core/Viewer.js +43 -30
- package/src/components/layout/Tabs.js +1 -0
- package/src/components/menus/MapLegend.js +22 -5
- package/src/components/menus/PictureLegend.js +32 -2
- package/src/components/menus/PictureMetadata.js +11 -2
- package/src/components/ui/AnnotationsSwitch.js +124 -0
- package/src/components/ui/Photo.js +1 -1
- package/src/components/ui/index.js +1 -1
- package/src/components/ui/widgets/Legend.js +67 -13
- package/src/translations/en.json +3 -0
- package/src/translations/fr.json +5 -0
- package/src/utils/services.js +8 -0
- package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +18 -6
- package/tests/components/core/__snapshots__/Viewer.test.js.snap +15 -3
- package/docs/reference/components/ui/HashTags.md +0 -15
- package/src/components/ui/HashTags.js +0 -98
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {LitElement, html, css} from "lit";
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
2
|
import { panel } from "../../styles";
|
|
3
3
|
import { fa } from "../../../utils/widgets";
|
|
4
4
|
import { faInfoCircle } from "@fortawesome/free-solid-svg-icons/faInfoCircle";
|
|
5
5
|
import PanoramaxImg from "../../../img/panoramax.svg";
|
|
6
6
|
import { classMap } from "lit/directives/class-map.js";
|
|
7
|
+
import { PanoramaxWebsiteURL } from "../../../utils/services";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Legend widget, handling switch between map and photo components.
|
|
@@ -55,6 +56,40 @@ export default class Legend extends LitElement {
|
|
|
55
56
|
.logo {
|
|
56
57
|
width: 45px;
|
|
57
58
|
}
|
|
59
|
+
pnx-map-legend {
|
|
60
|
+
display: block;
|
|
61
|
+
margin-top: 5px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Lighter/smaller version */
|
|
65
|
+
.pnx-panel[part="panel"].pnx-legend-light {
|
|
66
|
+
display: flex;
|
|
67
|
+
gap: 3px;
|
|
68
|
+
padding: 3px 8px 3px 3px;
|
|
69
|
+
width: unset;
|
|
70
|
+
min-width: unset;
|
|
71
|
+
align-items: center;
|
|
72
|
+
font-size: 10px;
|
|
73
|
+
margin-right: -10px;
|
|
74
|
+
margin-bottom: -10px;
|
|
75
|
+
border-radius: 0;
|
|
76
|
+
border-top-left-radius: 5px;
|
|
77
|
+
border-right: none;
|
|
78
|
+
border-bottom: none;
|
|
79
|
+
}
|
|
80
|
+
.pnx-legend-light a,
|
|
81
|
+
.pnx-legend-light .presentation {
|
|
82
|
+
font-size: 10px;
|
|
83
|
+
}
|
|
84
|
+
.pnx-legend-light .logo {
|
|
85
|
+
width: 15px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.pnx-legend-light pnx-map-legend {
|
|
89
|
+
width: max-content;
|
|
90
|
+
margin-top: unset;
|
|
91
|
+
font-size: 10px;
|
|
92
|
+
}
|
|
58
93
|
`];
|
|
59
94
|
|
|
60
95
|
/**
|
|
@@ -63,41 +98,59 @@ export default class Legend extends LitElement {
|
|
|
63
98
|
* @type {Object}
|
|
64
99
|
* @property {string} [focus] The focused main component (map, pic)
|
|
65
100
|
* @property {string} [picture] The picture ID
|
|
101
|
+
* @property {boolean} [light=false] Lighter version (for iframes)
|
|
66
102
|
*/
|
|
67
103
|
static properties = {
|
|
68
104
|
focus: {type: String},
|
|
69
105
|
picture: {type: String},
|
|
106
|
+
light: {type: Boolean},
|
|
70
107
|
};
|
|
71
108
|
|
|
109
|
+
constructor() {
|
|
110
|
+
super();
|
|
111
|
+
this.light = false;
|
|
112
|
+
}
|
|
113
|
+
|
|
72
114
|
render() {
|
|
73
115
|
const classes = {
|
|
74
116
|
"pnx-panel": true,
|
|
75
117
|
"pnx-padded": this.focus == "map",
|
|
118
|
+
"pnx-legend-light": this.light,
|
|
76
119
|
};
|
|
77
120
|
|
|
78
121
|
return html`<div class=${classMap(classes)} part="panel">
|
|
79
122
|
<div
|
|
80
123
|
class="presentation"
|
|
81
|
-
style=${this.focus != "map" && this.picture ? "display: none": ""}
|
|
124
|
+
style=${!this.light && this.focus != "map" && this.picture ? "display: none": ""}
|
|
82
125
|
>
|
|
83
126
|
<img class="logo" src=${PanoramaxImg} alt="" />
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<
|
|
127
|
+
|
|
128
|
+
${this.light ? html`
|
|
129
|
+
© <a
|
|
130
|
+
href=${PanoramaxWebsiteURL()}
|
|
87
131
|
title=${this._parent?._t.map.more_panoramax}
|
|
88
|
-
kind="superinline"
|
|
89
|
-
href="https://panoramax.fr"
|
|
90
132
|
target="_blank"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
133
|
+
>${this._parent?._t.pnx.panoramax}</a> |
|
|
134
|
+
` : html`
|
|
135
|
+
<div>
|
|
136
|
+
${this._parent?._t.pnx.whats_panoramax}
|
|
137
|
+
<pnx-link-button
|
|
138
|
+
title=${this._parent?._t.map.more_panoramax}
|
|
139
|
+
kind="superinline"
|
|
140
|
+
href=${PanoramaxWebsiteURL()}
|
|
141
|
+
target="_blank"
|
|
142
|
+
size="sm"
|
|
143
|
+
>
|
|
144
|
+
${fa(faInfoCircle)}
|
|
145
|
+
</pnx-link-button>
|
|
146
|
+
</div>
|
|
147
|
+
`}
|
|
96
148
|
</div>
|
|
97
149
|
<pnx-picture-legend
|
|
98
150
|
._parent=${this._parent}
|
|
99
151
|
style=${this.focus == "map" ? "display: none": ""}
|
|
100
152
|
collapsable
|
|
153
|
+
light=${this.light}
|
|
101
154
|
>
|
|
102
155
|
<slot slot="editors" name="editors">
|
|
103
156
|
<pnx-widget-osmeditors ._parent=${this._parent} />
|
|
@@ -105,7 +158,8 @@ export default class Legend extends LitElement {
|
|
|
105
158
|
</pnx-picture-legend>
|
|
106
159
|
<pnx-map-legend
|
|
107
160
|
._parent=${this._parent}
|
|
108
|
-
style=${this.focus != "map" ? "display: none": "
|
|
161
|
+
style=${this.focus != "map" ? "display: none": ""}
|
|
162
|
+
light=${this.light}
|
|
109
163
|
></pnx-map-legend>
|
|
110
164
|
</div>`;
|
|
111
165
|
}
|
package/src/translations/en.json
CHANGED
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"share_embed": "Embed on your website",
|
|
40
40
|
"share_embed_docs": "Read more about embed configuration",
|
|
41
41
|
"share_print": "Print",
|
|
42
|
+
"panoramax": "Panoramax",
|
|
42
43
|
"whats_panoramax": "Panoramax is the geo-commons for territories' pictures.",
|
|
43
44
|
"copy": "Copy",
|
|
44
45
|
"copied": "Copied",
|
|
@@ -191,6 +192,8 @@
|
|
|
191
192
|
"semantics_qualifiers": "Qualifiers",
|
|
192
193
|
"semantics_show_annotations": "Display picture annotations",
|
|
193
194
|
"semantics_hide_annotations": "Hide picture annotations",
|
|
195
|
+
"semantics_zero_annotations": "(no annotation set on this picture)",
|
|
196
|
+
"semantics_hashtags": "Picture hashtags",
|
|
194
197
|
"semantics_wikidata_properties": {
|
|
195
198
|
"P31": "instance of",
|
|
196
199
|
"P279": "subclass of",
|
package/src/translations/fr.json
CHANGED
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"share_embed": "Intégration sur votre site",
|
|
40
40
|
"share_embed_docs": "Découvrir plus de possibilités pour l'intégration sur votre site",
|
|
41
41
|
"share_print": "Imprimer",
|
|
42
|
+
"panoramax": "Panoramax",
|
|
42
43
|
"whats_panoramax": "Panoramax est le géocommun des photos des territoires.",
|
|
43
44
|
"copy": "Copier",
|
|
44
45
|
"copied": "Copié",
|
|
@@ -189,6 +190,10 @@
|
|
|
189
190
|
"semantics_tags_picture": "Attributs de la photo",
|
|
190
191
|
"semantics_tags_picture_none": "Aucun attribut n'a été défini pour cette photo pour l'instant.",
|
|
191
192
|
"semantics_qualifiers": "Qualificateurs",
|
|
193
|
+
"semantics_show_annotations": "Afficher les annotations de photo",
|
|
194
|
+
"semantics_hide_annotations": "Masquer les annotations de photo",
|
|
195
|
+
"semantics_zero_annotations": "(aucune annotation sur cette image)",
|
|
196
|
+
"semantics_hashtags": "Mots-dièse de la photo",
|
|
192
197
|
"semantics_wikidata_properties": {
|
|
193
198
|
"P31": "instance de",
|
|
194
199
|
"P279": "sous-classe de",
|
package/src/utils/services.js
CHANGED
|
@@ -10,6 +10,13 @@ exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
|
10
10
|
slot="top"
|
|
11
11
|
/>,
|
|
12
12
|
],
|
|
13
|
+
Array [
|
|
14
|
+
<pnx-annotations-switch
|
|
15
|
+
class="pnx-only-psv pnx-print-hidden"
|
|
16
|
+
size="xl"
|
|
17
|
+
slot="top"
|
|
18
|
+
/>,
|
|
19
|
+
],
|
|
13
20
|
Array [
|
|
14
21
|
<pnx-widget-zoom
|
|
15
22
|
class="pnx-print-hidden"
|
|
@@ -23,12 +30,6 @@ exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
|
23
30
|
slot="top-left"
|
|
24
31
|
/>,
|
|
25
32
|
],
|
|
26
|
-
Array [
|
|
27
|
-
<pnx-hashtags
|
|
28
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
29
|
-
slot="top-right"
|
|
30
|
-
/>,
|
|
31
|
-
],
|
|
32
33
|
],
|
|
33
34
|
"results": Array [
|
|
34
35
|
Object {
|
|
@@ -61,6 +62,13 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
61
62
|
slot="top"
|
|
62
63
|
/>,
|
|
63
64
|
],
|
|
65
|
+
Array [
|
|
66
|
+
<pnx-annotations-switch
|
|
67
|
+
class="pnx-only-psv pnx-print-hidden"
|
|
68
|
+
size="xl"
|
|
69
|
+
slot="top"
|
|
70
|
+
/>,
|
|
71
|
+
],
|
|
64
72
|
Array [
|
|
65
73
|
<pnx-bottom-drawer
|
|
66
74
|
slot="bottom"
|
|
@@ -78,6 +86,10 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
78
86
|
"type": "return",
|
|
79
87
|
"value": undefined,
|
|
80
88
|
},
|
|
89
|
+
Object {
|
|
90
|
+
"type": "return",
|
|
91
|
+
"value": undefined,
|
|
92
|
+
},
|
|
81
93
|
],
|
|
82
94
|
}
|
|
83
95
|
`;
|
|
@@ -17,13 +17,14 @@ exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
|
17
17
|
/>,
|
|
18
18
|
],
|
|
19
19
|
Array [
|
|
20
|
-
<pnx-
|
|
20
|
+
<pnx-widget-player
|
|
21
21
|
class="pnx-only-psv pnx-print-hidden"
|
|
22
|
-
|
|
22
|
+
size="xl"
|
|
23
|
+
slot="top"
|
|
23
24
|
/>,
|
|
24
25
|
],
|
|
25
26
|
Array [
|
|
26
|
-
<pnx-
|
|
27
|
+
<pnx-annotations-switch
|
|
27
28
|
class="pnx-only-psv pnx-print-hidden"
|
|
28
29
|
size="xl"
|
|
29
30
|
slot="top"
|
|
@@ -105,6 +106,13 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
105
106
|
slot="top"
|
|
106
107
|
/>,
|
|
107
108
|
],
|
|
109
|
+
Array [
|
|
110
|
+
<pnx-annotations-switch
|
|
111
|
+
class="pnx-only-psv pnx-print-hidden"
|
|
112
|
+
size="xl"
|
|
113
|
+
slot="top"
|
|
114
|
+
/>,
|
|
115
|
+
],
|
|
108
116
|
Array [
|
|
109
117
|
<pnx-widget-geosearch
|
|
110
118
|
class="pnx-only-map pnx-print-hidden"
|
|
@@ -150,6 +158,10 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
150
158
|
"type": "return",
|
|
151
159
|
"value": undefined,
|
|
152
160
|
},
|
|
161
|
+
Object {
|
|
162
|
+
"type": "return",
|
|
163
|
+
"value": undefined,
|
|
164
|
+
},
|
|
153
165
|
],
|
|
154
166
|
}
|
|
155
167
|
`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<a name="Panoramax.components.ui.HashTags"></a>
|
|
2
|
-
|
|
3
|
-
## Panoramax.components.ui.HashTags ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
|
|
4
|
-
**Kind**: static class of <code>Panoramax.components.ui</code>
|
|
5
|
-
**Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
|
|
6
|
-
**Element**: pnx-hashtags
|
|
7
|
-
<a name="new_Panoramax.components.ui.HashTags_new"></a>
|
|
8
|
-
|
|
9
|
-
### new HashTags()
|
|
10
|
-
HashTags component shows the list of hashtags associated to a picture.
|
|
11
|
-
|
|
12
|
-
**Example**
|
|
13
|
-
```html
|
|
14
|
-
<pnx-hashtags ._parent=${viewer} />
|
|
15
|
-
```
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css, nothing } from "lit";
|
|
2
|
-
import { getHashTags, hasAnnotations } from "../../utils/picture";
|
|
3
|
-
import { fa } from "../../utils/widgets";
|
|
4
|
-
import { faDrawPolygon } from "@fortawesome/free-solid-svg-icons/faDrawPolygon";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* HashTags component shows the list of hashtags associated to a picture.
|
|
8
|
-
* @class Panoramax.components.ui.HashTags
|
|
9
|
-
* @element pnx-hashtags
|
|
10
|
-
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
|
|
11
|
-
* @example
|
|
12
|
-
* ```html
|
|
13
|
-
* <pnx-hashtags ._parent=${viewer} />
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export default class HashTags extends LitElement {
|
|
17
|
-
/** @private */
|
|
18
|
-
static styles = css`
|
|
19
|
-
div {
|
|
20
|
-
background: linear-gradient(to bottom left, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.2));
|
|
21
|
-
margin-top: -10px;
|
|
22
|
-
margin-right: -10px;
|
|
23
|
-
padding: 5px 10px;
|
|
24
|
-
border-bottom-left-radius: 10px;
|
|
25
|
-
font-family: var(--font-family);
|
|
26
|
-
color: white;
|
|
27
|
-
font-size: 0.8em;
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
/** @private */
|
|
32
|
-
static properties = {
|
|
33
|
-
_tags: {state: true},
|
|
34
|
-
_visible: {state: true},
|
|
35
|
-
_annotationsToggled: {state: true},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
constructor() {
|
|
39
|
-
super();
|
|
40
|
-
this._tags = [];
|
|
41
|
-
this._visible = false;
|
|
42
|
-
this._annotationsToggled = false;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** @private */
|
|
46
|
-
connectedCallback() {
|
|
47
|
-
super.connectedCallback();
|
|
48
|
-
|
|
49
|
-
this._parent.onceReady().then(() => {
|
|
50
|
-
this._tags = getHashTags(this._parent?.psv?.getPictureMetadata?.());
|
|
51
|
-
|
|
52
|
-
// Component visibility : only if seen at least one pic with semantics
|
|
53
|
-
if(
|
|
54
|
-
!this._visible && (
|
|
55
|
-
this._tags.length > 0
|
|
56
|
-
|| hasAnnotations(this._parent?.psv?.getPictureMetadata?.())
|
|
57
|
-
)
|
|
58
|
-
) {
|
|
59
|
-
this._visible = true;
|
|
60
|
-
this._parent.psv.toggleAllAnnotations(true);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
this._parent.psv.addEventListener("picture-loaded", () => {
|
|
64
|
-
this._tags = getHashTags(this._parent.psv.getPictureMetadata());
|
|
65
|
-
if(
|
|
66
|
-
!this._visible && (
|
|
67
|
-
this._tags.length > 0 ||
|
|
68
|
-
hasAnnotations(this._parent.psv.getPictureMetadata())
|
|
69
|
-
)
|
|
70
|
-
) {
|
|
71
|
-
this._visible = true;
|
|
72
|
-
this._parent.psv.toggleAllAnnotations(true);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
this._annotationsToggled = this._parent.psv.areAnnotationsVisible() || false;
|
|
77
|
-
this._parent.psv.addEventListener("annotations-toggled", e => {
|
|
78
|
-
this._annotationsToggled = e.detail.visible;
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** @private */
|
|
84
|
-
render() {
|
|
85
|
-
return this._visible ? html`<div>
|
|
86
|
-
${this._tags.join(" ")}
|
|
87
|
-
<pnx-button
|
|
88
|
-
kind="outline"
|
|
89
|
-
style="vertical-align: middle"
|
|
90
|
-
title=${this._annotationsToggled ? this._parent._t?.pnx.semantics_hide_annotations : this._parent._t?.pnx.semantics_show_annotations}
|
|
91
|
-
active=${this._annotationsToggled ? "" : nothing}
|
|
92
|
-
@click=${() => this._parent.psv.toggleAllAnnotations(!this._annotationsToggled)}
|
|
93
|
-
>${fa(faDrawPolygon)}</pnx-button>
|
|
94
|
-
</div>` : nothing;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
customElements.define("pnx-hashtags", HashTags);
|