@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/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"/><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>
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: "&copy; IGN",
10
10
  tileSize: 256
11
11
  }
12
- }'/><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>
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "4.0.3-develop-28e2e30a",
3
+ "version": "4.0.3-develop-001b0de1",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
package/public/photo.html CHANGED
@@ -33,7 +33,7 @@
33
33
  class="fullpage"
34
34
  sequence="ecfe4b2c-0acd-4d3a-a10d-c3e6818755c8"
35
35
  picture="329af5c6-4761-4a6d-9c1e-674fd6daa8b6"
36
- />
36
+ ></pnx-photo-viewer>
37
37
 
38
38
  <script>
39
39
  var servers = {
@@ -43,7 +43,7 @@
43
43
  tileSize: 256
44
44
  }
45
45
  }'
46
- />
46
+ ></pnx-viewer>
47
47
 
48
48
  <script>
49
49
  var servers = {
@@ -59,6 +59,12 @@ export default class CoverageMap extends Basic {
59
59
  });
60
60
  }
61
61
 
62
+ /** @private */
63
+ disconnectedCallback() {
64
+ super.disconnectedCallback();
65
+ this.map?.destroy();
66
+ }
67
+
62
68
  getClassName() {
63
69
  return "CoverageMap";
64
70
  }
@@ -83,6 +83,13 @@ export default class Editor extends Basic {
83
83
  });
84
84
  }
85
85
 
86
+ /** @private */
87
+ disconnectedCallback() {
88
+ super.disconnectedCallback();
89
+ this.map?.destroy();
90
+ this.psv?.destroy();
91
+ }
92
+
86
93
  getClassName() {
87
94
  return "Editor";
88
95
  }
@@ -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", () => keytonone());
337
- this.popup.addEventListener("close", () => keytopsv());
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(cn.getAttribute("slot") !== "bg") {
342
- cn.addEventListener("focusin", () => keytonone());
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(cn.getAttribute("slot") !== "bg") {
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) {
@@ -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