@panoramax/web-viewer 4.0.3-develop-bcecb20b → 4.0.3-develop-2c5cb935
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 -0
- package/build/index.css +1 -1
- package/build/index.css.map +1 -1
- package/build/index.js +11 -5
- package/build/index.js.map +1 -1
- package/docs/reference/components/core/Editor.md +18 -0
- package/docs/reference/components/ui/Map.md +2 -1
- package/docs/reference/components/ui/MapMore.md +1 -0
- package/package.json +1 -1
- package/src/components/core/Editor.css +1 -0
- package/src/components/core/Editor.js +49 -7
- package/src/components/menus/PictureLegend.js +10 -4
- package/src/components/ui/Map.js +1 -1
- package/tests/components/core/Editor.test.js +1 -1
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
**Extends**: [<code>Basic</code>](Basic.md/#Panoramax.components.core.Basic)
|
|
6
6
|
**Emits**: [<code>select</code>](Basic.md/#Panoramax.components.core.Basic+event_select), [<code>ready</code>](Basic.md/#Panoramax.components.core.Basic+event_ready), [<code>broken</code>](Basic.md/#Panoramax.components.core.Basic+event_broken)
|
|
7
7
|
**Element**: pnx-editor
|
|
8
|
+
**Slot**: `top-left` The top-left corner
|
|
9
|
+
**Slot**: `top` The top middle corner
|
|
10
|
+
**Slot**: `top-right` The top-right corner
|
|
11
|
+
**Slot**: `bottom-left` The bottom-left corner
|
|
12
|
+
**Slot**: `bottom` The bottom middle corner
|
|
13
|
+
**Slot**: `bottom-right` The bottom-right corner
|
|
8
14
|
**Properties**
|
|
9
15
|
|
|
10
16
|
| Name | Type | Description |
|
|
@@ -13,6 +19,7 @@
|
|
|
13
19
|
| api | [<code>API</code>](../../utils/API.md/#Panoramax.utils.API) | The API manager |
|
|
14
20
|
| map | [<code>Map</code>](../ui/Map.md/#Panoramax.components.ui.Map) | The MapLibre GL map itself |
|
|
15
21
|
| psv | [<code>Photo</code>](../ui/Photo.md/#Panoramax.components.ui.Photo) | The Photo Sphere Viewer component itself |
|
|
22
|
+
| grid | [<code>CorneredGrid</code>](../layout/CorneredGrid.md/#Panoramax.components.layout.CorneredGrid) | The grid layout manager |
|
|
16
23
|
|
|
17
24
|
|
|
18
25
|
* [.Editor](#Panoramax.components.core.Editor) ⇐ [<code>Basic</code>](Basic.md/#Panoramax.components.core.Basic)
|
|
@@ -40,12 +47,23 @@ It shows both picture and map.
|
|
|
40
47
|
|
|
41
48
|
Make sure to set width/height through CSS for proper display.
|
|
42
49
|
|
|
50
|
+
This component has a [CorneredGrid](../layout/CorneredGrid.md/#Panoramax.components.layout.CorneredGrid) layout, you can use directly any slot element to pass custom widgets.
|
|
51
|
+
|
|
43
52
|
**Example**
|
|
44
53
|
```html
|
|
54
|
+
<!-- Basic example -->
|
|
45
55
|
<pnx-editor
|
|
46
56
|
endpoint="https://panoramax.openstreetmap.fr/"
|
|
47
57
|
style="width: 300px; height: 250px"
|
|
48
58
|
/>
|
|
59
|
+
|
|
60
|
+
<!-- With slotted widgets -->
|
|
61
|
+
<pnx-editor
|
|
62
|
+
endpoint="https://panoramax.openstreetmap.fr/"
|
|
63
|
+
style="width: 300px; height: 250px"
|
|
64
|
+
>
|
|
65
|
+
<p slot="top-right">My custom text</p>
|
|
66
|
+
</pnx-editor>
|
|
49
67
|
```
|
|
50
68
|
<a name="Panoramax.components.core.Editor+properties"></a>
|
|
51
69
|
|
|
@@ -51,7 +51,7 @@ A shorthand `addEventListener` function is added for simpler usage.
|
|
|
51
51
|
| [options.raster] | <code>object</code> | | The MapLibre raster source for aerial background. This must be a JSON object following [MapLibre raster source definition](https://maplibre.org/maplibre-style-spec/sources/#raster). |
|
|
52
52
|
| [options.background] | <code>string</code> | <code>"streets"</code> | Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street. |
|
|
53
53
|
| [options.attributionControl.customAttribution] | <code>string</code> | | To override default map attribution. |
|
|
54
|
-
| [options.picMarkerDraggable] | boolean |
|
|
54
|
+
| [options.picMarkerDraggable] | <code>boolean</code> | | To make the picture marker draggable, default to false. |
|
|
55
55
|
|
|
56
56
|
**Example**
|
|
57
57
|
```js
|
|
@@ -160,6 +160,7 @@ Shows on map a picture position and heading.
|
|
|
160
160
|
| lat | <code>number</code> | | The latitude |
|
|
161
161
|
| heading | <code>number</code> | | The heading |
|
|
162
162
|
| [skipCenter] | <code>boolean</code> | <code>false</code> | Set to true to avoid map centering on marker |
|
|
163
|
+
| [picId] | <code>string</code> | <code>null</code> | The picture Id |
|
|
163
164
|
|
|
164
165
|
<a name="Panoramax.components.ui.Map+reloadLayersStyles"></a>
|
|
165
166
|
|
|
@@ -159,6 +159,7 @@ Shows on map a picture position and heading.
|
|
|
159
159
|
| lat | <code>number</code> | | The latitude |
|
|
160
160
|
| heading | <code>number</code> | | The heading |
|
|
161
161
|
| [skipCenter] | <code>boolean</code> | <code>false</code> | Set to true to avoid map centering on marker |
|
|
162
|
+
| [picId] | <code>string</code> | <code>null</code> | The picture Id |
|
|
162
163
|
|
|
163
164
|
<a name="Panoramax.components.ui.Map+reloadLayersStyles"></a>
|
|
164
165
|
|
package/package.json
CHANGED
|
@@ -3,13 +3,10 @@ import "./Editor.css";
|
|
|
3
3
|
import Basic from "./Basic";
|
|
4
4
|
import Map from "../ui/Map";
|
|
5
5
|
import Photo from "../ui/Photo";
|
|
6
|
-
import BackgroundAerial from "../../img/bg_aerial.jpg";
|
|
7
|
-
import BackgroundStreets from "../../img/bg_streets.jpg";
|
|
8
6
|
import { apiFeatureToPSVNode } from "../../utils/picture";
|
|
9
7
|
import { linkMapAndPhoto } from "../../utils/map";
|
|
10
8
|
import { VECTOR_STYLES } from "../../utils/map";
|
|
11
9
|
import { SYSTEM as PSSystem } from "@photo-sphere-viewer/core";
|
|
12
|
-
import { css } from "lit";
|
|
13
10
|
import { createWebComp } from "../../utils/widgets";
|
|
14
11
|
|
|
15
12
|
const LAYER_HEADING_ID = "sequence-headings";
|
|
@@ -19,6 +16,8 @@ const LAYER_HEADING_ID = "sequence-headings";
|
|
|
19
16
|
* It shows both picture and map.
|
|
20
17
|
*
|
|
21
18
|
* Make sure to set width/height through CSS for proper display.
|
|
19
|
+
*
|
|
20
|
+
* This component has a [CorneredGrid](#Panoramax.components.layout.CorneredGrid) layout, you can use directly any slot element to pass custom widgets.
|
|
22
21
|
* @class Panoramax.components.core.Editor
|
|
23
22
|
* @element pnx-editor
|
|
24
23
|
* @extends Panoramax.components.core.Basic
|
|
@@ -29,12 +28,28 @@ const LAYER_HEADING_ID = "sequence-headings";
|
|
|
29
28
|
* @property {Panoramax.utils.API} api The API manager
|
|
30
29
|
* @property {Panoramax.components.ui.Map} map The MapLibre GL map itself
|
|
31
30
|
* @property {Panoramax.components.ui.Photo} psv The Photo Sphere Viewer component itself
|
|
31
|
+
* @property {Panoramax.components.layout.CorneredGrid} grid The grid layout manager
|
|
32
|
+
* @slot `top-left` The top-left corner
|
|
33
|
+
* @slot `top` The top middle corner
|
|
34
|
+
* @slot `top-right` The top-right corner
|
|
35
|
+
* @slot `bottom-left` The bottom-left corner
|
|
36
|
+
* @slot `bottom` The bottom middle corner
|
|
37
|
+
* @slot `bottom-right` The bottom-right corner
|
|
32
38
|
* @example
|
|
33
39
|
* ```html
|
|
40
|
+
* <!-- Basic example -->
|
|
34
41
|
* <pnx-editor
|
|
35
42
|
* endpoint="https://panoramax.openstreetmap.fr/"
|
|
36
43
|
* style="width: 300px; height: 250px"
|
|
37
44
|
* />
|
|
45
|
+
*
|
|
46
|
+
* <!-- With slotted widgets -->
|
|
47
|
+
* <pnx-editor
|
|
48
|
+
* endpoint="https://panoramax.openstreetmap.fr/"
|
|
49
|
+
* style="width: 300px; height: 250px"
|
|
50
|
+
* >
|
|
51
|
+
* <p slot="top-right">My custom text</p>
|
|
52
|
+
* </pnx-editor>
|
|
38
53
|
* ```
|
|
39
54
|
*/
|
|
40
55
|
export default class Editor extends Basic {
|
|
@@ -67,7 +82,13 @@ export default class Editor extends Basic {
|
|
|
67
82
|
|
|
68
83
|
// Create sub-containers
|
|
69
84
|
this._psvContainer = document.createElement("div");
|
|
85
|
+
this._psvContainer.setAttribute("slot", "bg");
|
|
70
86
|
this._mapContainer = document.createElement("div");
|
|
87
|
+
this._mapContainer.setAttribute("slot", "bg");
|
|
88
|
+
|
|
89
|
+
this.grid = createWebComp("pnx-cornered-grid");
|
|
90
|
+
this.grid.appendChild(this._psvContainer);
|
|
91
|
+
this.grid.appendChild(this._mapContainer);
|
|
71
92
|
|
|
72
93
|
this.onceAPIReady().then(() => {
|
|
73
94
|
this.loader.setAttribute("value", 30);
|
|
@@ -111,6 +132,12 @@ export default class Editor extends Basic {
|
|
|
111
132
|
super.connectedCallback();
|
|
112
133
|
}
|
|
113
134
|
|
|
135
|
+
/** @private */
|
|
136
|
+
firstUpdated() {
|
|
137
|
+
super.firstUpdated();
|
|
138
|
+
this._moveChildToGrid();
|
|
139
|
+
}
|
|
140
|
+
|
|
114
141
|
attributeChangedCallback(name, old, value) {
|
|
115
142
|
if(name === "users" && Array.isArray(value) && value.length > 0) {
|
|
116
143
|
console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible");
|
|
@@ -122,11 +149,11 @@ export default class Editor extends Basic {
|
|
|
122
149
|
|
|
123
150
|
/** @private */
|
|
124
151
|
render() {
|
|
125
|
-
return [this.loader, this.
|
|
152
|
+
return [this.loader, this.grid];
|
|
126
153
|
}
|
|
127
154
|
|
|
128
155
|
getSubComponentsNames() {
|
|
129
|
-
return super.getSubComponentsNames().concat(["map", "psv"]);
|
|
156
|
+
return super.getSubComponentsNames().concat(["map", "psv", "grid"]);
|
|
130
157
|
}
|
|
131
158
|
|
|
132
159
|
/** @private */
|
|
@@ -321,8 +348,23 @@ export default class Editor extends Basic {
|
|
|
321
348
|
*/
|
|
322
349
|
_addMapBackgroundWidget() {
|
|
323
350
|
// Container
|
|
324
|
-
const pnlLayers = createWebComp("pnx-map-background", {_parent: this, size: "sm"});
|
|
325
|
-
this.
|
|
351
|
+
const pnlLayers = createWebComp("pnx-map-background", {_parent: this, size: "sm", slot: "bottom-left"});
|
|
352
|
+
this.grid.appendChild(pnlLayers);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** @private */
|
|
356
|
+
_moveChildToGrid() {
|
|
357
|
+
const slotContent = Array.from(this.querySelectorAll("[slot]"));
|
|
358
|
+
|
|
359
|
+
slotContent.forEach(n => {
|
|
360
|
+
// Add parent + translation for our components
|
|
361
|
+
if(n.tagName?.toLowerCase().startsWith("pnx-")) {
|
|
362
|
+
n._parent = this;
|
|
363
|
+
n._t = this._t;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
this.grid.appendChild(n);
|
|
367
|
+
});
|
|
326
368
|
}
|
|
327
369
|
|
|
328
370
|
/**
|
|
@@ -28,14 +28,17 @@ export default class PictureLegend extends LitElement {
|
|
|
28
28
|
:host {
|
|
29
29
|
overflow-y: auto;
|
|
30
30
|
overflow-x: hidden;
|
|
31
|
-
display:
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
32
33
|
margin: 0;
|
|
33
34
|
font-family: var(--font-family);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
@media screen and (min-width: 576px) {
|
|
37
|
-
:host {
|
|
38
|
-
|
|
38
|
+
:host {
|
|
39
|
+
max-height: 70vh;
|
|
40
|
+
width: 30vw;
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
/* Top bar */
|
|
@@ -59,6 +62,9 @@ export default class PictureLegend extends LitElement {
|
|
|
59
62
|
margin-bottom: 2px;
|
|
60
63
|
flex-grow: 5;
|
|
61
64
|
font-weight: 800;
|
|
65
|
+
text-overflow: ellipsis;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
white-space: nowrap;
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
#pic-legend-addr span {
|
|
@@ -212,7 +218,7 @@ export default class PictureLegend extends LitElement {
|
|
|
212
218
|
</pnx-button>
|
|
213
219
|
` : nothing}
|
|
214
220
|
|
|
215
|
-
<div id="pic-legend-addr">
|
|
221
|
+
<div id="pic-legend-addr" title=${this._addr || ""}>
|
|
216
222
|
${this._addr?.length > 0 ? this._addr : html`<span class="pnx-placeholder-loading"> </span>`}
|
|
217
223
|
</div>
|
|
218
224
|
|
package/src/components/ui/Map.js
CHANGED
|
@@ -422,7 +422,7 @@ export default class Map extends maplibregl.Map {
|
|
|
422
422
|
* @param {number} lat The latitude
|
|
423
423
|
* @param {number} heading The heading
|
|
424
424
|
* @param {boolean} [skipCenter=false] Set to true to avoid map centering on marker
|
|
425
|
-
* @param {string} picId The picture Id
|
|
425
|
+
* @param {string} [picId=null] The picture Id
|
|
426
426
|
*/
|
|
427
427
|
displayPictureMarker(lon, lat, heading, skipCenter = false, picId = null) {
|
|
428
428
|
this._picMarkerPreview.remove();
|
|
@@ -15,6 +15,6 @@ describe("getClassName", () => {
|
|
|
15
15
|
|
|
16
16
|
describe("getSubComponentsNames", () => {
|
|
17
17
|
it("works", () => {
|
|
18
|
-
expect(comp.getSubComponentsNames()).toEqual(["loader", "api", "map", "psv"]);
|
|
18
|
+
expect(comp.getSubComponentsNames()).toEqual(["loader", "api", "map", "psv", "grid"]);
|
|
19
19
|
});
|
|
20
20
|
});
|