@panoramax/web-viewer 4.0.3-develop-5b0cd5bb → 4.0.3-develop-25adfc80
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 +1 -0
- package/build/index.css +1 -1
- package/build/index.css.map +1 -1
- package/build/index.js +130 -51
- 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/widgets/Legend.md +5 -4
- 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 +42 -29
- package/src/components/menus/MapLegend.js +22 -5
- package/src/components/menus/PictureLegend.js +32 -2
- package/src/components/ui/AnnotationsSwitch.js +39 -11
- package/src/components/ui/Photo.js +1 -1
- package/src/components/ui/widgets/Legend.js +67 -13
- package/src/translations/en.json +1 -0
- package/src/translations/fr.json +1 -0
- package/src/utils/services.js +8 -0
- package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +2 -0
- package/tests/components/core/__snapshots__/Viewer.test.js.snap +2 -0
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
**Kind**: static class of <code>Panoramax.components.menus</code>
|
|
5
5
|
**Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
|
|
6
6
|
**Element**: pnx-map-legend
|
|
7
|
+
|
|
8
|
+
* [.MapLegend](#Panoramax.components.menus.MapLegend) ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
|
|
9
|
+
* [new MapLegend()](#new_Panoramax.components.menus.MapLegend_new)
|
|
10
|
+
* [.properties](#Panoramax.components.menus.MapLegend+properties) : <code>Object</code>
|
|
11
|
+
|
|
7
12
|
<a name="new_Panoramax.components.menus.MapLegend_new"></a>
|
|
8
13
|
|
|
9
14
|
### new MapLegend()
|
|
@@ -13,3 +18,15 @@ Map legend displays information about map sources.
|
|
|
13
18
|
```html
|
|
14
19
|
<pnx-map-legend ._parent=${viewer} />
|
|
15
20
|
```
|
|
21
|
+
<a name="Panoramax.components.menus.MapLegend+properties"></a>
|
|
22
|
+
|
|
23
|
+
### mapLegend.properties : <code>Object</code>
|
|
24
|
+
Component properties.
|
|
25
|
+
|
|
26
|
+
**Kind**: instance property of [<code>MapLegend</code>](#Panoramax.components.menus.MapLegend)
|
|
27
|
+
**Properties**
|
|
28
|
+
|
|
29
|
+
| Name | Type | Default | Description |
|
|
30
|
+
| --- | --- | --- | --- |
|
|
31
|
+
| [light] | <code>boolean</code> | <code>false</code> | Lighter version (for iframes) |
|
|
32
|
+
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
**Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
|
|
6
6
|
**Element**: pnx-picture-legend
|
|
7
7
|
**Slot**: `editors` External links to map editors, or any tool that may be helpful. Defaults to OSM tools (iD & JOSM).
|
|
8
|
+
|
|
9
|
+
* [.PictureLegend](#Panoramax.components.menus.PictureLegend) ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
|
|
10
|
+
* [new PictureLegend()](#new_Panoramax.components.menus.PictureLegend_new)
|
|
11
|
+
* [.properties](#Panoramax.components.menus.PictureLegend+properties) : <code>Object</code>
|
|
12
|
+
|
|
8
13
|
<a name="new_Panoramax.components.menus.PictureLegend_new"></a>
|
|
9
14
|
|
|
10
15
|
### new PictureLegend()
|
|
@@ -14,3 +19,15 @@ Picture legend shows info about picture author, capture date, address, and acces
|
|
|
14
19
|
```html
|
|
15
20
|
<pnx-picture-legend ._parent=${viewer} />
|
|
16
21
|
```
|
|
22
|
+
<a name="Panoramax.components.menus.PictureLegend+properties"></a>
|
|
23
|
+
|
|
24
|
+
### pictureLegend.properties : <code>Object</code>
|
|
25
|
+
Component properties.
|
|
26
|
+
|
|
27
|
+
**Kind**: instance property of [<code>PictureLegend</code>](#Panoramax.components.menus.PictureLegend)
|
|
28
|
+
**Properties**
|
|
29
|
+
|
|
30
|
+
| Name | Type | Default | Description |
|
|
31
|
+
| --- | --- | --- | --- |
|
|
32
|
+
| [light] | <code>boolean</code> | <code>false</code> | Lighter version (for iframes) |
|
|
33
|
+
|
|
@@ -42,8 +42,9 @@ Component properties.
|
|
|
42
42
|
**Kind**: instance property of [<code>Legend</code>](#Panoramax.components.ui.widgets.Legend)
|
|
43
43
|
**Properties**
|
|
44
44
|
|
|
45
|
-
| Name | Type | Description |
|
|
46
|
-
| --- | --- | --- |
|
|
47
|
-
| [focus] | <code>string</code> | The focused main component (map, pic) |
|
|
48
|
-
| [picture] | <code>string</code> | The picture ID |
|
|
45
|
+
| Name | Type | Default | Description |
|
|
46
|
+
| --- | --- | --- | --- |
|
|
47
|
+
| [focus] | <code>string</code> | | The focused main component (map, pic) |
|
|
48
|
+
| [picture] | <code>string</code> | | The picture ID |
|
|
49
|
+
| [light] | <code>boolean</code> | <code>false</code> | Lighter version (for iframes) |
|
|
49
50
|
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ import URLHandler from "../../utils/URLHandler";
|
|
|
7
7
|
import Basic from "./Basic";
|
|
8
8
|
import Photo, { PSV_DEFAULT_ZOOM, PSV_ANIM_DURATION } from "../ui/Photo";
|
|
9
9
|
import { createWebComp } from "../../utils/widgets";
|
|
10
|
-
import { isNullId } from "../../utils/utils";
|
|
10
|
+
import { isNullId, isInIframe } from "../../utils/utils";
|
|
11
11
|
import { default as InitParameters, alterPSVState, alterMapState, alterPhotoViewerState } from "../../utils/InitParameters";
|
|
12
12
|
import PresetManager from "../../utils/PresetsManager";
|
|
13
13
|
|
|
@@ -125,20 +125,33 @@ export default class PhotoViewer extends Basic {
|
|
|
125
125
|
/** @private */
|
|
126
126
|
_initWidgets() {
|
|
127
127
|
if(this._initParams.getParentPostInit().widgets !== "false") {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
128
|
+
if(!isInIframe()) {
|
|
129
|
+
this.grid.appendChild(createWebComp("pnx-widget-player", {
|
|
130
|
+
slot: "top",
|
|
131
|
+
_parent: this,
|
|
132
|
+
class: "pnx-only-psv pnx-print-hidden",
|
|
133
|
+
size: this.isHeightSmall() ? "md": "xl",
|
|
134
|
+
}));
|
|
135
|
+
|
|
136
|
+
this.grid.appendChild(createWebComp("pnx-annotations-switch", {
|
|
137
|
+
slot: "top",
|
|
138
|
+
_parent: this,
|
|
139
|
+
class: "pnx-only-psv pnx-print-hidden",
|
|
140
|
+
size: this.isHeightSmall() ? "md": "xl",
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if(isInIframe()) {
|
|
145
|
+
this.legend = createWebComp("pnx-widget-legend", {
|
|
146
|
+
slot: "bottom-right",
|
|
147
|
+
light: true,
|
|
148
|
+
_parent: this,
|
|
149
|
+
focus: this._initParams.getParentPostInit().focus,
|
|
150
|
+
picture: this._initParams.getParentPostInit().picture,
|
|
151
|
+
});
|
|
152
|
+
this.grid.appendChild(this.legend);
|
|
153
|
+
}
|
|
154
|
+
else if(!this.isWidthSmall()) {
|
|
142
155
|
this.legend = createWebComp("pnx-widget-legend", {
|
|
143
156
|
slot: !this.isWidthSmall() ? "top-left" : undefined,
|
|
144
157
|
_parent: this,
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
import "./Viewer.css";
|
|
4
4
|
import { linkMapAndPhoto, saveMapParamsToLocalStorage, getMapParamsFromLocalStorage } from "../../utils/map";
|
|
5
5
|
import PhotoViewer, {KEYBOARD_SKIP_FOCUS_WIDGETS} from "./PhotoViewer";
|
|
6
|
-
import Basic from "./Basic";
|
|
7
6
|
import MapMore from "../ui/MapMore";
|
|
8
7
|
import { initMapKeyboardHandler } from "../../utils/map";
|
|
9
|
-
import { isNullId } from "../../utils/utils";
|
|
8
|
+
import { isNullId, isInIframe } from "../../utils/utils";
|
|
10
9
|
import { createWebComp } from "../../utils/widgets";
|
|
11
10
|
import { fa } from "../../utils/widgets";
|
|
12
11
|
import { faPanorama } from "@fortawesome/free-solid-svg-icons/faPanorama";
|
|
@@ -16,7 +15,6 @@ import { default as InitParameters, alterMapState, alterViewerState } from "../.
|
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
export const PSV_ZOOM_DELTA = 20;
|
|
19
|
-
const PSV_MOVE_DELTA = Math.PI / 6;
|
|
20
18
|
const MAP_MOVE_DELTA = 100;
|
|
21
19
|
|
|
22
20
|
|
|
@@ -150,7 +148,17 @@ export default class Viewer extends PhotoViewer {
|
|
|
150
148
|
_parent: this
|
|
151
149
|
}));
|
|
152
150
|
|
|
153
|
-
if(
|
|
151
|
+
if(isInIframe()) {
|
|
152
|
+
this.legend = createWebComp("pnx-widget-legend", {
|
|
153
|
+
slot: "bottom-right",
|
|
154
|
+
light: true,
|
|
155
|
+
_parent: this,
|
|
156
|
+
focus: this._initParams.getParentPostInit().focus,
|
|
157
|
+
picture: this._initParams.getParentPostInit().picture,
|
|
158
|
+
});
|
|
159
|
+
this.grid.appendChild(this.legend);
|
|
160
|
+
}
|
|
161
|
+
else if(!this.isWidthSmall()) {
|
|
154
162
|
this.legend = createWebComp("pnx-widget-legend", {
|
|
155
163
|
slot: this.isWidthSmall() ? "top" : "top-left",
|
|
156
164
|
_parent: this,
|
|
@@ -174,33 +182,38 @@ export default class Viewer extends PhotoViewer {
|
|
|
174
182
|
});
|
|
175
183
|
}
|
|
176
184
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
if(!isInIframe()) {
|
|
186
|
+
this.grid.appendChild(createWebComp("pnx-widget-player", {
|
|
187
|
+
slot: "top",
|
|
188
|
+
_parent: this,
|
|
189
|
+
class: "pnx-only-psv pnx-print-hidden",
|
|
190
|
+
size: this.isHeightSmall() ? "md": "xl",
|
|
191
|
+
}));
|
|
192
|
+
|
|
193
|
+
this.grid.appendChild(createWebComp("pnx-annotations-switch", {
|
|
194
|
+
slot: "top",
|
|
195
|
+
_parent: this,
|
|
196
|
+
class: "pnx-only-psv pnx-print-hidden",
|
|
197
|
+
size: this.isHeightSmall() ? "md": "xl",
|
|
198
|
+
}));
|
|
183
199
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
200
|
+
this.grid.appendChild(createWebComp("pnx-widget-geosearch", {
|
|
201
|
+
slot: this.isWidthSmall() ? "top-right" : "top-left",
|
|
202
|
+
_parent: this,
|
|
203
|
+
class: "pnx-only-map pnx-print-hidden",
|
|
204
|
+
geocoder: this._initParams.getParentPostInit().geocoder,
|
|
205
|
+
}));
|
|
189
206
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
_parent: this,
|
|
199
|
-
|
|
200
|
-
"quality-score": this.map?._hasQualityScore?.() || false,
|
|
201
|
-
class: "pnx-only-map pnx-print-hidden",
|
|
202
|
-
}));
|
|
203
|
-
this.grid.appendChild(createWebComp("pnx-widget-maplayers", { slot: "top-right", _parent: this, class: "pnx-only-map pnx-print-hidden" }));
|
|
207
|
+
this.grid.appendChild(createWebComp("pnx-widget-mapfilters", {
|
|
208
|
+
slot: this.isWidthSmall() ? "top-right" : "top-left",
|
|
209
|
+
_parent: this,
|
|
210
|
+
"user-search": this.api._endpoints.user_search !== null && this.api._endpoints.user_tiles !== null,
|
|
211
|
+
"quality-score": this.map?._hasQualityScore?.() || false,
|
|
212
|
+
class: "pnx-only-map pnx-print-hidden",
|
|
213
|
+
}));
|
|
214
|
+
|
|
215
|
+
this.grid.appendChild(createWebComp("pnx-widget-maplayers", { slot: "top-right", _parent: this, class: "pnx-only-map pnx-print-hidden" }));
|
|
216
|
+
}
|
|
204
217
|
}
|
|
205
218
|
}
|
|
206
219
|
|
|
@@ -24,17 +24,34 @@ export default class MapLegend extends LitElement {
|
|
|
24
24
|
}
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Component properties.
|
|
29
|
+
* @memberof Panoramax.components.menus.MapLegend#
|
|
30
|
+
* @type {Object}
|
|
31
|
+
* @property {boolean} [light=false] Lighter version (for iframes)
|
|
32
|
+
*/
|
|
33
|
+
static properties = {
|
|
34
|
+
light: {type: Boolean},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
constructor() {
|
|
38
|
+
super();
|
|
39
|
+
this.light = false;
|
|
40
|
+
}
|
|
41
|
+
|
|
27
42
|
/** @private */
|
|
28
43
|
render() {
|
|
29
44
|
/* eslint-disable indent */
|
|
30
45
|
const mapAttrib = this._parent?.map?._attribution?._innerContainer;
|
|
31
46
|
const mapLabelParts = this._parent?._t.map.map_data.split("{m}");
|
|
32
47
|
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
return this.light ?
|
|
49
|
+
(mapAttrib && mapAttrib.innerHTML.length > 0 ? mapAttrib : nothing)
|
|
50
|
+
: html`
|
|
51
|
+
${mapAttrib && mapAttrib.innerHTML.length > 0
|
|
52
|
+
? html`${mapLabelParts.shift()}${mapAttrib}${mapLabelParts.shift()}`
|
|
53
|
+
: nothing}
|
|
54
|
+
`;
|
|
38
55
|
}
|
|
39
56
|
}
|
|
40
57
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { LitElement,
|
|
1
|
+
import { LitElement, nothing, css } from "lit";
|
|
2
|
+
import { html, unsafeStatic } from "lit/static-html.js";
|
|
2
3
|
import { classMap } from "lit/directives/class-map.js";
|
|
3
4
|
import { fa } from "../../utils/widgets";
|
|
4
5
|
import { faArrowLeft } from "@fortawesome/free-solid-svg-icons/faArrowLeft";
|
|
@@ -127,10 +128,22 @@ export default class PictureLegend extends LitElement {
|
|
|
127
128
|
|
|
128
129
|
/* Editors */
|
|
129
130
|
#pic-legend-editors { margin: 0 10px; }
|
|
131
|
+
|
|
132
|
+
/* Light version */
|
|
133
|
+
.pnx-picture-legend-light {
|
|
134
|
+
width: max-content;
|
|
135
|
+
font-size: 10px;
|
|
136
|
+
}
|
|
130
137
|
`];
|
|
131
138
|
|
|
132
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* Component properties.
|
|
141
|
+
* @memberof Panoramax.components.menus.PictureLegend#
|
|
142
|
+
* @type {Object}
|
|
143
|
+
* @property {boolean} [light=false] Lighter version (for iframes)
|
|
144
|
+
*/
|
|
133
145
|
static properties = {
|
|
146
|
+
light: {type: Boolean},
|
|
134
147
|
_caption: { state: true },
|
|
135
148
|
_addr: { state: true },
|
|
136
149
|
_expanded: { state: true },
|
|
@@ -142,6 +155,7 @@ export default class PictureLegend extends LitElement {
|
|
|
142
155
|
super();
|
|
143
156
|
this._expanded = true;
|
|
144
157
|
this.collapsable = false;
|
|
158
|
+
this.light = false;
|
|
145
159
|
}
|
|
146
160
|
|
|
147
161
|
/** @private */
|
|
@@ -209,6 +223,22 @@ export default class PictureLegend extends LitElement {
|
|
|
209
223
|
const hiddenExpanded = classMap({"pnx-hidden": this._expanded});
|
|
210
224
|
const shownExpanded = classMap({"pnx-hidden": !this._expanded});
|
|
211
225
|
|
|
226
|
+
if(this.light) {
|
|
227
|
+
return html`<div class="pnx-picture-legend-light">
|
|
228
|
+
${this._caption.producer?.length > 0 ? html`
|
|
229
|
+
<a
|
|
230
|
+
href=${window.location.href}
|
|
231
|
+
target="_blank"
|
|
232
|
+
title=${this._parent?._t.pnx.share_page}
|
|
233
|
+
>${this._caption.producer[this._caption.producer.length-1]}</a>
|
|
234
|
+
</div>` : nothing}
|
|
235
|
+
|
|
236
|
+
${this._caption.producer?.length > 0 && this._caption?.license ? "|" : ""}
|
|
237
|
+
|
|
238
|
+
${this._caption?.license ? html`${unsafeStatic(this._caption.license)}` : nothing}
|
|
239
|
+
`;
|
|
240
|
+
}
|
|
241
|
+
|
|
212
242
|
return html`
|
|
213
243
|
<div class="headline">
|
|
214
244
|
${this._parent._setFocus ? html`
|
|
@@ -17,16 +17,31 @@ import { hasAnnotations } from "../../utils/picture";
|
|
|
17
17
|
export default class AnnotationsSwitch extends LitElement {
|
|
18
18
|
/** @private */
|
|
19
19
|
static styles = css`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
/* Custom button look */
|
|
21
|
+
pnx-button::part(btn) {
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
height: 26px;
|
|
24
|
+
width: 26px;
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
pnx-button[size="xl"]::part(btn) {
|
|
28
|
+
border-radius: 8px;
|
|
29
|
+
height: 38px;
|
|
30
|
+
width: 38px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* No-annotations badge */
|
|
25
34
|
.pnx-annotations-switch-empty {
|
|
26
35
|
position: absolute;
|
|
36
|
+
top: 1px;
|
|
37
|
+
right: 1px;
|
|
38
|
+
color: var(--orange);
|
|
39
|
+
height: 8px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
pnx-button[size="xl"] .pnx-annotations-switch-empty {
|
|
27
43
|
top: 2px;
|
|
28
44
|
right: 2px;
|
|
29
|
-
color: var(--orange);
|
|
30
45
|
height: 12px;
|
|
31
46
|
}
|
|
32
47
|
|
|
@@ -35,8 +50,15 @@ export default class AnnotationsSwitch extends LitElement {
|
|
|
35
50
|
}
|
|
36
51
|
`;
|
|
37
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Component properties.
|
|
55
|
+
* @memberof Panoramax.components.ui.AnnotationsSwitch#
|
|
56
|
+
* @type {Object}
|
|
57
|
+
* @property {string} [size=xl] Button size (md, xl)
|
|
58
|
+
*/
|
|
38
59
|
/** @private */
|
|
39
60
|
static properties = {
|
|
61
|
+
size: {type: String},
|
|
40
62
|
_annotationsToggled: {state: true},
|
|
41
63
|
_warnNoAnnot: {state: true},
|
|
42
64
|
};
|
|
@@ -45,6 +67,7 @@ export default class AnnotationsSwitch extends LitElement {
|
|
|
45
67
|
super();
|
|
46
68
|
this._annotationsToggled = false;
|
|
47
69
|
this._warnNoAnnot = false;
|
|
70
|
+
this.size = "xl";
|
|
48
71
|
}
|
|
49
72
|
|
|
50
73
|
/** @private */
|
|
@@ -52,11 +75,6 @@ export default class AnnotationsSwitch extends LitElement {
|
|
|
52
75
|
super.connectedCallback();
|
|
53
76
|
|
|
54
77
|
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
78
|
this._parent.psv.addEventListener("annotations-toggled", e => {
|
|
61
79
|
this._annotationsToggled = e.detail.visible;
|
|
62
80
|
});
|
|
@@ -66,6 +84,15 @@ export default class AnnotationsSwitch extends LitElement {
|
|
|
66
84
|
this._warnNoAnnot = !hasAnnotations(this._parent.psv.getPictureMetadata());
|
|
67
85
|
});
|
|
68
86
|
});
|
|
87
|
+
|
|
88
|
+
this._parent.onceFirstPicLoaded().then(() => {
|
|
89
|
+
this._annotationsToggled = this._parent.psv.areAnnotationsVisible() || false;
|
|
90
|
+
|
|
91
|
+
if(!this._annotationsToggled) {
|
|
92
|
+
this._parent.psv.toggleAllAnnotations(true);
|
|
93
|
+
this._annotationsToggled = true;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
69
96
|
}
|
|
70
97
|
|
|
71
98
|
_onClick() {
|
|
@@ -78,7 +105,8 @@ export default class AnnotationsSwitch extends LitElement {
|
|
|
78
105
|
return html`
|
|
79
106
|
<pnx-button
|
|
80
107
|
kind="outline"
|
|
81
|
-
|
|
108
|
+
size=${this.size}
|
|
109
|
+
style="vertical-align: middle"
|
|
82
110
|
title=${[
|
|
83
111
|
this._annotationsToggled ? this._parent._t?.pnx.semantics_hide_annotations : this._parent._t?.pnx.semantics_show_annotations,
|
|
84
112
|
this._warnNoAnnot ? this._parent._t?.pnx.semantics_zero_annotations : null
|
|
@@ -86,7 +114,7 @@ export default class AnnotationsSwitch extends LitElement {
|
|
|
86
114
|
active=${this._annotationsToggled ? "" : nothing}
|
|
87
115
|
@click=${this._onClick}
|
|
88
116
|
>
|
|
89
|
-
${fa(faTags)}
|
|
117
|
+
${fa(faTags, { styles: { "height": "unset" }})}
|
|
90
118
|
${this._warnNoAnnot ? fa(faTriangleExclamation, { classes: "pnx-annotations-switch-empty" }) : nothing}
|
|
91
119
|
</pnx-button>
|
|
92
120
|
`;
|
|
@@ -954,7 +954,7 @@ export default class Photo extends PSViewer {
|
|
|
954
954
|
|
|
955
955
|
if(!visible) { this._myMarkers.clearMarkers(); }
|
|
956
956
|
else {
|
|
957
|
-
let annotations = meta.properties.annotations;
|
|
957
|
+
let annotations = meta.properties.annotations || [];
|
|
958
958
|
if(annotations?.length === 0) { console.warn("No annotation available on picture", meta.id); }
|
|
959
959
|
|
|
960
960
|
const picBData = this.state.textureData.panoData?.baseData;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {LitElement, html, css} from "lit";
|
|
1
|
+
import { LitElement, html, css, nothing } 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 || nothing}
|
|
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 || nothing}
|
|
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",
|
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é",
|
package/src/utils/services.js
CHANGED
|
@@ -13,6 +13,7 @@ exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
|
13
13
|
Array [
|
|
14
14
|
<pnx-annotations-switch
|
|
15
15
|
class="pnx-only-psv pnx-print-hidden"
|
|
16
|
+
size="xl"
|
|
16
17
|
slot="top"
|
|
17
18
|
/>,
|
|
18
19
|
],
|
|
@@ -64,6 +65,7 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
64
65
|
Array [
|
|
65
66
|
<pnx-annotations-switch
|
|
66
67
|
class="pnx-only-psv pnx-print-hidden"
|
|
68
|
+
size="xl"
|
|
67
69
|
slot="top"
|
|
68
70
|
/>,
|
|
69
71
|
],
|
|
@@ -26,6 +26,7 @@ exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
|
26
26
|
Array [
|
|
27
27
|
<pnx-annotations-switch
|
|
28
28
|
class="pnx-only-psv pnx-print-hidden"
|
|
29
|
+
size="xl"
|
|
29
30
|
slot="top"
|
|
30
31
|
/>,
|
|
31
32
|
],
|
|
@@ -108,6 +109,7 @@ exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
|
108
109
|
Array [
|
|
109
110
|
<pnx-annotations-switch
|
|
110
111
|
class="pnx-only-psv pnx-print-hidden"
|
|
112
|
+
size="xl"
|
|
111
113
|
slot="top"
|
|
112
114
|
/>,
|
|
113
115
|
],
|