@panoramax/web-viewer 4.0.3-develop-28e2e30a → 4.0.3-develop-001b0de1
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.js +3 -3
- package/build/index.js.map +1 -1
- package/build/photo.html +1 -1
- package/build/viewer.html +1 -1
- package/docs/reference/utils/URLHandler.md +7 -0
- package/package.json +1 -1
- package/public/photo.html +1 -1
- package/public/viewer.html +1 -1
- package/src/components/core/CoverageMap.js +6 -0
- package/src/components/core/Editor.js +7 -0
- package/src/components/core/PhotoViewer.js +16 -4
- package/src/components/core/Viewer.js +11 -2
- package/src/utils/URLHandler.js +8 -0
package/build/photo.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><title>Panoramax Photo Viewer</title><style>#viewer{position:relative;width:95%;margin:2.5%;height:400px}#viewer.fullpage{position:fixed;top:0;bottom:0;left:0;right:0;height:unset;width:unset;margin:0}</style><script defer="defer" src="index.js"></script><link href="index.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><pnx-photo-viewer id="viewer" class="fullpage" sequence="ecfe4b2c-0acd-4d3a-a10d-c3e6818755c8" picture="329af5c6-4761-4a6d-9c1e-674fd6daa8b6"
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><title>Panoramax Photo Viewer</title><style>#viewer{position:relative;width:95%;margin:2.5%;height:400px}#viewer.fullpage{position:fixed;top:0;bottom:0;left:0;right:0;height:unset;width:unset;margin:0}</style><script defer="defer" src="index.js"></script><link href="index.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><pnx-photo-viewer id="viewer" class="fullpage" sequence="ecfe4b2c-0acd-4d3a-a10d-c3e6818755c8" picture="329af5c6-4761-4a6d-9c1e-674fd6daa8b6"></pnx-photo-viewer><script>var servers={meta:"https://api.panoramax.xyz/api",ign:"https://panoramax.ign.fr/api",osm:"https://panoramax.openstreetmap.fr/api",local:"http://localhost:5000/api",dev:"https://panoramax.codeureusesenliberte.fr/api"},urlParams=new URLSearchParams(window.location.search),server=servers[urlParams.get("server")||"meta"];window.onload=()=>{document.getElementById("viewer").setAttribute("endpoint",server)}</script></body></html>
|
package/build/viewer.html
CHANGED
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
attribution: "© IGN",
|
|
10
10
|
tileSize: 256
|
|
11
11
|
}
|
|
12
|
-
}'
|
|
12
|
+
}'></pnx-viewer><script>var servers={meta:"https://api.panoramax.xyz/api",ign:"https://panoramax.ign.fr/api",osm:"https://panoramax.openstreetmap.fr/api",local:"http://localhost:5000/api",dev:"https://panoramax.codeureusesenliberte.fr/api"},urlParams=new URLSearchParams(window.location.search),server=servers[urlParams.get("server")||"meta"];window.onload=()=>{document.getElementById("viewer").setAttribute("endpoint",server)}</script></body></html>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* [.URLHandler](#Panoramax.utils.URLHandler)
|
|
8
8
|
* [new URLHandler(parent)](#new_Panoramax.utils.URLHandler_new)
|
|
9
9
|
* [.listenToChanges()](#Panoramax.utils.URLHandler+listenToChanges)
|
|
10
|
+
* [.destroy()](#Panoramax.utils.URLHandler+destroy)
|
|
10
11
|
* [.nextURLParams()](#Panoramax.utils.URLHandler+nextURLParams) ⇒ <code>object</code>
|
|
11
12
|
* [.nextURLString()](#Panoramax.utils.URLHandler+nextURLString) ⇒ <code>string</code>
|
|
12
13
|
* [.currentURLParams([readFromHash])](#Panoramax.utils.URLHandler+currentURLParams) ⇒ <code>object</code>
|
|
@@ -34,6 +35,12 @@ Note that you may call `listenToChanges()` for this class to be effective once p
|
|
|
34
35
|
Start listening to URL & parent changes through events.
|
|
35
36
|
This leads to parent & URL updates.
|
|
36
37
|
|
|
38
|
+
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
|
|
39
|
+
<a name="Panoramax.utils.URLHandler+destroy"></a>
|
|
40
|
+
|
|
41
|
+
### urlHandler.destroy()
|
|
42
|
+
Call this function to stop listening to global events.
|
|
43
|
+
|
|
37
44
|
**Kind**: instance method of [<code>URLHandler</code>](#Panoramax.utils.URLHandler)
|
|
38
45
|
<a name="Panoramax.utils.URLHandler+nextURLParams"></a>
|
|
39
46
|
|
package/package.json
CHANGED
package/public/photo.html
CHANGED
package/public/viewer.html
CHANGED
|
@@ -14,6 +14,7 @@ import PresetManager from "../../utils/PresetsManager";
|
|
|
14
14
|
|
|
15
15
|
export const PSV_ZOOM_DELTA = 20;
|
|
16
16
|
const PSV_MOVE_DELTA = Math.PI / 6;
|
|
17
|
+
export const KEYBOARD_SKIP_FOCUS_WIDGETS = ["pnx-mini", "pnx-widget-player", "pnx-widget-zoom"];
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -186,6 +187,13 @@ export default class PhotoViewer extends Basic {
|
|
|
186
187
|
this.onceAPIReady().then(this._postAPIInit.bind(this));
|
|
187
188
|
}
|
|
188
189
|
|
|
190
|
+
/** @private */
|
|
191
|
+
disconnectedCallback() {
|
|
192
|
+
super.disconnectedCallback();
|
|
193
|
+
this.urlHandler?.destroy();
|
|
194
|
+
this.psv?.destroy();
|
|
195
|
+
}
|
|
196
|
+
|
|
189
197
|
/** @private */
|
|
190
198
|
firstUpdated() {
|
|
191
199
|
super.firstUpdated();
|
|
@@ -333,13 +341,17 @@ export default class PhotoViewer extends Basic {
|
|
|
333
341
|
const keytopsv = () => this.psv.startKeyboardControl();
|
|
334
342
|
|
|
335
343
|
// Popup
|
|
336
|
-
this.popup.addEventListener("open",
|
|
337
|
-
this.popup.addEventListener("close",
|
|
344
|
+
this.popup.addEventListener("open", keytonone);
|
|
345
|
+
this.popup.addEventListener("close", keytopsv);
|
|
346
|
+
this.psv.addEventListener("click", keytopsv);
|
|
338
347
|
|
|
339
348
|
// Widgets
|
|
340
349
|
for(let cn of this.grid.childNodes) {
|
|
341
|
-
if(
|
|
342
|
-
cn.
|
|
350
|
+
if(
|
|
351
|
+
cn.getAttribute("slot") !== "bg"
|
|
352
|
+
&& !KEYBOARD_SKIP_FOCUS_WIDGETS.includes(cn.tagName.toLowerCase())
|
|
353
|
+
) {
|
|
354
|
+
cn.addEventListener("focusin", keytonone);
|
|
343
355
|
cn.addEventListener("focusout", () => {
|
|
344
356
|
if(this.popup.getAttribute("visible") === null) {
|
|
345
357
|
keytopsv();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import "./Viewer.css";
|
|
4
4
|
import { linkMapAndPhoto, saveMapParamsToLocalStorage, getMapParamsFromLocalStorage } from "../../utils/map";
|
|
5
|
-
import PhotoViewer from "./PhotoViewer";
|
|
5
|
+
import PhotoViewer, {KEYBOARD_SKIP_FOCUS_WIDGETS} from "./PhotoViewer";
|
|
6
6
|
import Basic from "./Basic";
|
|
7
7
|
import MapMore from "../ui/MapMore";
|
|
8
8
|
import { initMapKeyboardHandler } from "../../utils/map";
|
|
@@ -204,6 +204,12 @@ export default class Viewer extends PhotoViewer {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
+
/** @private */
|
|
208
|
+
disconnectedCallback() {
|
|
209
|
+
super.disconnectedCallback();
|
|
210
|
+
this.map?.destroy();
|
|
211
|
+
}
|
|
212
|
+
|
|
207
213
|
getClassName() {
|
|
208
214
|
return "Viewer";
|
|
209
215
|
}
|
|
@@ -371,7 +377,10 @@ export default class Viewer extends PhotoViewer {
|
|
|
371
377
|
|
|
372
378
|
// Widgets
|
|
373
379
|
for(let cn of this.grid.childNodes) {
|
|
374
|
-
if(
|
|
380
|
+
if(
|
|
381
|
+
cn.getAttribute("slot") !== "bg"
|
|
382
|
+
&& !KEYBOARD_SKIP_FOCUS_WIDGETS.includes(cn.tagName.toLowerCase())
|
|
383
|
+
) {
|
|
375
384
|
cn.addEventListener("focusin", () => keytonone());
|
|
376
385
|
cn.addEventListener("focusout", () => {
|
|
377
386
|
if(this.popup.getAttribute("visible") === null) {
|
package/src/utils/URLHandler.js
CHANGED
|
@@ -45,6 +45,14 @@ export default class URLHandler extends EventTarget {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Call this function to stop listening to global events.
|
|
50
|
+
* @memberof Panoramax.utils.URLHandler#
|
|
51
|
+
*/
|
|
52
|
+
destroy() {
|
|
53
|
+
window.removeEventListener("popstate", this._onURLChange);
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
/**
|
|
49
57
|
* Compute next values to insert in URL
|
|
50
58
|
* @returns {object} Query parameters
|