@panoramax/web-viewer 4.0.3-develop-d48b09a7 → 4.0.3-develop-5b0cd5bb
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 +2 -1
- package/build/index.js +41 -32
- package/build/index.js.map +1 -1
- package/docs/reference/components/ui/AnnotationsSwitch.md +15 -0
- package/docs/reference.md +1 -1
- package/mkdocs.yml +1 -1
- package/package.json +1 -1
- package/src/components/core/PhotoViewer.js +6 -6
- package/src/components/core/Viewer.js +6 -6
- package/src/components/layout/Tabs.js +1 -0
- package/src/components/menus/PictureMetadata.js +11 -2
- package/src/components/ui/AnnotationsSwitch.js +96 -0
- package/src/components/ui/index.js +1 -1
- package/src/translations/en.json +2 -0
- package/src/translations/fr.json +4 -0
- package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +16 -6
- package/tests/components/core/__snapshots__/Viewer.test.js.snap +14 -4
- package/docs/reference/components/ui/HashTags.md +0 -15
- package/src/components/ui/HashTags.js +0 -98
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<a name="Panoramax.components.ui.AnnotationsSwitch"></a>
|
|
2
|
+
|
|
3
|
+
## Panoramax.components.ui.AnnotationsSwitch ⇐ <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-annotations-switch
|
|
7
|
+
<a name="new_Panoramax.components.ui.AnnotationsSwitch_new"></a>
|
|
8
|
+
|
|
9
|
+
### new AnnotationsSwitch()
|
|
10
|
+
AnnotationsSwitch component allows to switch on/off pictures annotations.
|
|
11
|
+
|
|
12
|
+
**Example**
|
|
13
|
+
```html
|
|
14
|
+
<pnx-annotations-switch ._parent=${viewer} />
|
|
15
|
+
```
|
package/docs/reference.md
CHANGED
|
@@ -41,11 +41,11 @@ All-in-one, ready-to-use menus for complex operations. Note that they don't embe
|
|
|
41
41
|
|
|
42
42
|
Basic UI components:
|
|
43
43
|
|
|
44
|
+
- [AnnotationsSwitch](./reference/components/ui/AnnotationsSwitch.md) : a switch button for showing/hiding picture annotations.
|
|
44
45
|
- [Button](./reference/components/ui/Button.md) : a simple button.
|
|
45
46
|
- [ButtonGroup](./reference/components/ui/ButtonGroup.md) : button bar.
|
|
46
47
|
- [CopyButton](./reference/components/ui/CopyButton.md) : a copy-to-clipboard button.
|
|
47
48
|
- [Grade](./reference/components/ui/Grade.md) : a 5-star rating display.
|
|
48
|
-
- [HashTags](./reference/components/ui/HashTags.md) : a list of hashtags associated to a picture.
|
|
49
49
|
- [LinkButton](./reference/components/ui/LinkButton.md) : a link button.
|
|
50
50
|
- [ListGroup](./reference/components/ui/ListGroup.md) : a menu-like list of buttons and links.
|
|
51
51
|
- [ListItem](./reference/components/ui/ListItem.md) : a Material Design-like list entry.
|
package/mkdocs.yml
CHANGED
|
@@ -87,11 +87,11 @@ nav:
|
|
|
87
87
|
- PictureLegendActions: 'reference/components/ui/widgets/PictureLegendActions.md'
|
|
88
88
|
- Player: 'reference/components/ui/widgets/Player.md'
|
|
89
89
|
- Zoom: 'reference/components/ui/widgets/Zoom.md'
|
|
90
|
+
- AnnotationsSwitch: 'reference/components/ui/AnnotationsSwitch.md'
|
|
90
91
|
- Button: 'reference/components/ui/Button.md'
|
|
91
92
|
- ButtonGroup: 'reference/components/ui/ButtonGroup.md'
|
|
92
93
|
- CopyButton: 'reference/components/ui/CopyButton.md'
|
|
93
94
|
- Grade: 'reference/components/ui/Grade.md'
|
|
94
|
-
- HashTags: 'reference/components/ui/HashTags.md'
|
|
95
95
|
- LinkButton: 'reference/components/ui/LinkButton.md'
|
|
96
96
|
- ListGroup: 'reference/components/ui/ListGroup.md'
|
|
97
97
|
- ListItem: 'reference/components/ui/ListItem.md'
|
package/package.json
CHANGED
|
@@ -132,6 +132,12 @@ export default class PhotoViewer extends Basic {
|
|
|
132
132
|
size: this.isHeightSmall() ? "md": "xl",
|
|
133
133
|
}));
|
|
134
134
|
|
|
135
|
+
this.grid.appendChild(createWebComp("pnx-annotations-switch", {
|
|
136
|
+
slot: "top",
|
|
137
|
+
_parent: this,
|
|
138
|
+
class: "pnx-only-psv pnx-print-hidden",
|
|
139
|
+
}));
|
|
140
|
+
|
|
135
141
|
if(!this.isWidthSmall()) {
|
|
136
142
|
this.legend = createWebComp("pnx-widget-legend", {
|
|
137
143
|
slot: !this.isWidthSmall() ? "top-left" : undefined,
|
|
@@ -146,12 +152,6 @@ export default class PhotoViewer extends Basic {
|
|
|
146
152
|
_parent: this
|
|
147
153
|
}));
|
|
148
154
|
this.grid.appendChild(this.legend);
|
|
149
|
-
|
|
150
|
-
this.grid.appendChild(createWebComp("pnx-hashtags", {
|
|
151
|
-
slot: "top-right",
|
|
152
|
-
_parent: this,
|
|
153
|
-
class: "pnx-only-psv pnx-print-hidden",
|
|
154
|
-
}));
|
|
155
155
|
}
|
|
156
156
|
else {
|
|
157
157
|
this.legend = createWebComp("pnx-picture-legend", { _parent: this });
|
|
@@ -158,12 +158,6 @@ export default class Viewer extends PhotoViewer {
|
|
|
158
158
|
picture: this._initParams.getParentPostInit().picture,
|
|
159
159
|
});
|
|
160
160
|
this.grid.appendChild(this.legend);
|
|
161
|
-
|
|
162
|
-
this.grid.appendChild(createWebComp("pnx-hashtags", {
|
|
163
|
-
slot: "top-right",
|
|
164
|
-
_parent: this,
|
|
165
|
-
class: "pnx-only-psv pnx-print-hidden",
|
|
166
|
-
}));
|
|
167
161
|
}
|
|
168
162
|
else {
|
|
169
163
|
this.legend = createWebComp("pnx-picture-legend", { _parent: this });
|
|
@@ -187,6 +181,12 @@ export default class Viewer extends PhotoViewer {
|
|
|
187
181
|
size: this.isHeightSmall() ? "md": "xl",
|
|
188
182
|
}));
|
|
189
183
|
|
|
184
|
+
this.grid.appendChild(createWebComp("pnx-annotations-switch", {
|
|
185
|
+
slot: "top",
|
|
186
|
+
_parent: this,
|
|
187
|
+
class: "pnx-only-psv pnx-print-hidden",
|
|
188
|
+
}));
|
|
189
|
+
|
|
190
190
|
this.grid.appendChild(createWebComp("pnx-widget-geosearch", {
|
|
191
191
|
slot: this.isWidthSmall() ? "top-right" : "top-left",
|
|
192
192
|
_parent: this,
|
|
@@ -14,7 +14,7 @@ import { faChevronUp } from "@fortawesome/free-solid-svg-icons/faChevronUp";
|
|
|
14
14
|
import { faTags } from "@fortawesome/free-solid-svg-icons/faTags";
|
|
15
15
|
import { faSvg, titles, textarea, hidden } from "../styles";
|
|
16
16
|
import { createWebComp } from "../../utils/widgets";
|
|
17
|
-
import { getGPSPrecision } from "../../utils/picture";
|
|
17
|
+
import { getGPSPrecision, getHashTags } from "../../utils/picture";
|
|
18
18
|
import { PanoramaxMetaCatalogURL } from "../../utils/services";
|
|
19
19
|
import {
|
|
20
20
|
getGrade, QUALITYSCORE_GPS_VALUES, QUALITYSCORE_RES_360_VALUES,
|
|
@@ -243,6 +243,16 @@ export default class PictureMetadata extends LitElement {
|
|
|
243
243
|
);
|
|
244
244
|
let semanticsData = [];
|
|
245
245
|
if(hasSemantics) {
|
|
246
|
+
// Hashtags
|
|
247
|
+
const hashtags = getHashTags(this._meta);
|
|
248
|
+
if(hashtags.length > 0) {
|
|
249
|
+
semanticsData.push({
|
|
250
|
+
title: this._parent?._t.pnx.semantics_hashtags,
|
|
251
|
+
style: "width: 100%",
|
|
252
|
+
content: hashtags.join(" ")
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
246
256
|
// Full list of picture tags
|
|
247
257
|
semanticsData.push({
|
|
248
258
|
title: this._parent?._t.pnx.semantics_tags_picture,
|
|
@@ -392,7 +402,6 @@ export default class PictureMetadata extends LitElement {
|
|
|
392
402
|
</strong>`
|
|
393
403
|
}
|
|
394
404
|
];
|
|
395
|
-
console.log("instance", this._meta.origInstance);
|
|
396
405
|
|
|
397
406
|
return html`<pnx-tabs>
|
|
398
407
|
${this._toTab( // General
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { LitElement, html, css, nothing } from "lit";
|
|
2
|
+
import { fa } from "../../utils/widgets";
|
|
3
|
+
import { faTags } from "@fortawesome/free-solid-svg-icons/faTags";
|
|
4
|
+
import { faTriangleExclamation } from "@fortawesome/free-solid-svg-icons/faTriangleExclamation";
|
|
5
|
+
import { hasAnnotations } from "../../utils/picture";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* AnnotationsSwitch component allows to switch on/off pictures annotations.
|
|
9
|
+
* @class Panoramax.components.ui.AnnotationsSwitch
|
|
10
|
+
* @element pnx-annotations-switch
|
|
11
|
+
* @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <pnx-annotations-switch ._parent=${viewer} />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export default class AnnotationsSwitch extends LitElement {
|
|
18
|
+
/** @private */
|
|
19
|
+
static styles = css`
|
|
20
|
+
div {
|
|
21
|
+
font-family: var(--font-family);
|
|
22
|
+
font-size: 0.8em;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.pnx-annotations-switch-empty {
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: 2px;
|
|
28
|
+
right: 2px;
|
|
29
|
+
color: var(--orange);
|
|
30
|
+
height: 12px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
pnx-button[active] .pnx-annotations-switch-empty {
|
|
34
|
+
color: var(--yellow);
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
/** @private */
|
|
39
|
+
static properties = {
|
|
40
|
+
_annotationsToggled: {state: true},
|
|
41
|
+
_warnNoAnnot: {state: true},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
constructor() {
|
|
45
|
+
super();
|
|
46
|
+
this._annotationsToggled = false;
|
|
47
|
+
this._warnNoAnnot = false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** @private */
|
|
51
|
+
connectedCallback() {
|
|
52
|
+
super.connectedCallback();
|
|
53
|
+
|
|
54
|
+
this._parent.onceReady().then(() => {
|
|
55
|
+
this._annotationsToggled = this._parent.psv.areAnnotationsVisible() || false;
|
|
56
|
+
if(!this._annotationsToggled) {
|
|
57
|
+
this._parent.psv.toggleAllAnnotations(true);
|
|
58
|
+
this._annotationsToggled = true;
|
|
59
|
+
}
|
|
60
|
+
this._parent.psv.addEventListener("annotations-toggled", e => {
|
|
61
|
+
this._annotationsToggled = e.detail.visible;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
this._warnNoAnnot = !hasAnnotations(this._parent.psv.getPictureMetadata());
|
|
65
|
+
this._parent.psv.addEventListener("picture-loaded", () => {
|
|
66
|
+
this._warnNoAnnot = !hasAnnotations(this._parent.psv.getPictureMetadata());
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_onClick() {
|
|
72
|
+
this._parent.psv.toggleAllAnnotations(!this._annotationsToggled);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @private */
|
|
76
|
+
render() {
|
|
77
|
+
/* eslint-disable indent */
|
|
78
|
+
return html`
|
|
79
|
+
<pnx-button
|
|
80
|
+
kind="outline"
|
|
81
|
+
style="vertical-align: middle; width: 37px; height: 37px"
|
|
82
|
+
title=${[
|
|
83
|
+
this._annotationsToggled ? this._parent._t?.pnx.semantics_hide_annotations : this._parent._t?.pnx.semantics_show_annotations,
|
|
84
|
+
this._warnNoAnnot ? this._parent._t?.pnx.semantics_zero_annotations : null
|
|
85
|
+
].filter(v => v).join(" ")}
|
|
86
|
+
active=${this._annotationsToggled ? "" : nothing}
|
|
87
|
+
@click=${this._onClick}
|
|
88
|
+
>
|
|
89
|
+
${fa(faTags)}
|
|
90
|
+
${this._warnNoAnnot ? fa(faTriangleExclamation, { classes: "pnx-annotations-switch-empty" }) : nothing}
|
|
91
|
+
</pnx-button>
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
customElements.define("pnx-annotations-switch", AnnotationsSwitch);
|
|
@@ -7,7 +7,7 @@ export {default as ButtonGroup} from "./ButtonGroup";
|
|
|
7
7
|
export {default as Button} from "./Button";
|
|
8
8
|
export {default as CopyButton} from "./CopyButton";
|
|
9
9
|
export {default as Grade} from "./Grade";
|
|
10
|
-
export {default as
|
|
10
|
+
export {default as AnnotationsSwitch} from "./AnnotationsSwitch";
|
|
11
11
|
export {default as LinkButton} from "./LinkButton";
|
|
12
12
|
export {default as ListGroup} from "./ListGroup";
|
|
13
13
|
export {default as ListItem} from "./ListItem";
|
package/src/translations/en.json
CHANGED
|
@@ -191,6 +191,8 @@
|
|
|
191
191
|
"semantics_qualifiers": "Qualifiers",
|
|
192
192
|
"semantics_show_annotations": "Display picture annotations",
|
|
193
193
|
"semantics_hide_annotations": "Hide picture annotations",
|
|
194
|
+
"semantics_zero_annotations": "(no annotation set on this picture)",
|
|
195
|
+
"semantics_hashtags": "Picture hashtags",
|
|
194
196
|
"semantics_wikidata_properties": {
|
|
195
197
|
"P31": "instance of",
|
|
196
198
|
"P279": "subclass of",
|
package/src/translations/fr.json
CHANGED
|
@@ -189,6 +189,10 @@
|
|
|
189
189
|
"semantics_tags_picture": "Attributs de la photo",
|
|
190
190
|
"semantics_tags_picture_none": "Aucun attribut n'a été défini pour cette photo pour l'instant.",
|
|
191
191
|
"semantics_qualifiers": "Qualificateurs",
|
|
192
|
+
"semantics_show_annotations": "Afficher les annotations de photo",
|
|
193
|
+
"semantics_hide_annotations": "Masquer les annotations de photo",
|
|
194
|
+
"semantics_zero_annotations": "(aucune annotation sur cette image)",
|
|
195
|
+
"semantics_hashtags": "Mots-dièse de la photo",
|
|
192
196
|
"semantics_wikidata_properties": {
|
|
193
197
|
"P31": "instance de",
|
|
194
198
|
"P279": "sous-classe de",
|
|
@@ -10,6 +10,12 @@ 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
|
+
slot="top"
|
|
17
|
+
/>,
|
|
18
|
+
],
|
|
13
19
|
Array [
|
|
14
20
|
<pnx-widget-zoom
|
|
15
21
|
class="pnx-print-hidden"
|
|
@@ -23,12 +29,6 @@ exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
|
23
29
|
slot="top-left"
|
|
24
30
|
/>,
|
|
25
31
|
],
|
|
26
|
-
Array [
|
|
27
|
-
<pnx-hashtags
|
|
28
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
29
|
-
slot="top-right"
|
|
30
|
-
/>,
|
|
31
|
-
],
|
|
32
32
|
],
|
|
33
33
|
"results": Array [
|
|
34
34
|
Object {
|
|
@@ -61,6 +61,12 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
61
61
|
slot="top"
|
|
62
62
|
/>,
|
|
63
63
|
],
|
|
64
|
+
Array [
|
|
65
|
+
<pnx-annotations-switch
|
|
66
|
+
class="pnx-only-psv pnx-print-hidden"
|
|
67
|
+
slot="top"
|
|
68
|
+
/>,
|
|
69
|
+
],
|
|
64
70
|
Array [
|
|
65
71
|
<pnx-bottom-drawer
|
|
66
72
|
slot="bottom"
|
|
@@ -78,6 +84,10 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
78
84
|
"type": "return",
|
|
79
85
|
"value": undefined,
|
|
80
86
|
},
|
|
87
|
+
Object {
|
|
88
|
+
"type": "return",
|
|
89
|
+
"value": undefined,
|
|
90
|
+
},
|
|
81
91
|
],
|
|
82
92
|
}
|
|
83
93
|
`;
|
|
@@ -17,15 +17,15 @@ 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
|
-
size="xl"
|
|
29
29
|
slot="top"
|
|
30
30
|
/>,
|
|
31
31
|
],
|
|
@@ -105,6 +105,12 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
105
105
|
slot="top"
|
|
106
106
|
/>,
|
|
107
107
|
],
|
|
108
|
+
Array [
|
|
109
|
+
<pnx-annotations-switch
|
|
110
|
+
class="pnx-only-psv pnx-print-hidden"
|
|
111
|
+
slot="top"
|
|
112
|
+
/>,
|
|
113
|
+
],
|
|
108
114
|
Array [
|
|
109
115
|
<pnx-widget-geosearch
|
|
110
116
|
class="pnx-only-map pnx-print-hidden"
|
|
@@ -150,6 +156,10 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
150
156
|
"type": "return",
|
|
151
157
|
"value": undefined,
|
|
152
158
|
},
|
|
159
|
+
Object {
|
|
160
|
+
"type": "return",
|
|
161
|
+
"value": undefined,
|
|
162
|
+
},
|
|
153
163
|
],
|
|
154
164
|
}
|
|
155
165
|
`;
|
|
@@ -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);
|