@panoramax/web-viewer 4.0.3-develop-e6a52885 → 4.0.3-develop-85c1e9c4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "4.0.3-develop-e6a52885",
3
+ "version": "4.0.3-develop-85c1e9c4",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -93,15 +93,15 @@
93
93
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
94
94
  "@fortawesome/free-regular-svg-icons": "^6.7.2",
95
95
  "@fortawesome/free-solid-svg-icons": "^6.7.2",
96
- "@photo-sphere-viewer/core": "5.12.1",
97
- "@photo-sphere-viewer/equirectangular-tiles-adapter": "5.12.1",
98
- "@photo-sphere-viewer/gallery-plugin": "5.12.1",
99
- "@photo-sphere-viewer/markers-plugin": "5.12.1",
100
- "@photo-sphere-viewer/virtual-tour-plugin": "5.12.1",
96
+ "@photo-sphere-viewer/core": "5.13.3",
97
+ "@photo-sphere-viewer/equirectangular-tiles-adapter": "5.13.3",
98
+ "@photo-sphere-viewer/gallery-plugin": "5.13.3",
99
+ "@photo-sphere-viewer/markers-plugin": "5.13.3",
100
+ "@photo-sphere-viewer/virtual-tour-plugin": "5.13.3",
101
101
  "iconify-icon": "^3.0.0",
102
102
  "json5": "^2.2.3",
103
103
  "lit": "^3.2.1",
104
- "maplibre-gl": "^5.3.0",
104
+ "maplibre-gl": "^5.6.0",
105
105
  "pmtiles": "^4.3.0",
106
106
  "query-selector-shadow-dom": "^1.0.1"
107
107
  },
@@ -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
  /**
@@ -333,13 +334,17 @@ export default class PhotoViewer extends Basic {
333
334
  const keytopsv = () => this.psv.startKeyboardControl();
334
335
 
335
336
  // Popup
336
- this.popup.addEventListener("open", () => keytonone());
337
- this.popup.addEventListener("close", () => keytopsv());
337
+ this.popup.addEventListener("open", keytonone);
338
+ this.popup.addEventListener("close", keytopsv);
339
+ this.psv.addEventListener("click", keytopsv);
338
340
 
339
341
  // Widgets
340
342
  for(let cn of this.grid.childNodes) {
341
- if(cn.getAttribute("slot") !== "bg") {
342
- cn.addEventListener("focusin", () => keytonone());
343
+ if(
344
+ cn.getAttribute("slot") !== "bg"
345
+ && !KEYBOARD_SKIP_FOCUS_WIDGETS.includes(cn.tagName.toLowerCase())
346
+ ) {
347
+ cn.addEventListener("focusin", keytonone);
343
348
  cn.addEventListener("focusout", () => {
344
349
  if(this.popup.getAttribute("visible") === null) {
345
350
  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";
@@ -371,7 +371,10 @@ export default class Viewer extends PhotoViewer {
371
371
 
372
372
  // Widgets
373
373
  for(let cn of this.grid.childNodes) {
374
- if(cn.getAttribute("slot") !== "bg") {
374
+ if(
375
+ cn.getAttribute("slot") !== "bg"
376
+ && !KEYBOARD_SKIP_FOCUS_WIDGETS.includes(cn.tagName.toLowerCase())
377
+ ) {
375
378
  cn.addEventListener("focusin", () => keytonone());
376
379
  cn.addEventListener("focusout", () => {
377
380
  if(this.popup.getAttribute("visible") === null) {
@@ -94,7 +94,7 @@ export default class Photo extends PSViewer {
94
94
  resolution: parent.isWidthSmall() ? 32 : 64,
95
95
  shouldGoFast: options.shouldGoFast,
96
96
  }],
97
- withCredentials: parent?.fetchOptions?.credentials == "include",
97
+ withCredentials: parent.api._getPSVWithCredentials(),
98
98
  requestHeaders: parent?.fetchOptions?.headers,
99
99
  panorama: BASE_PANORAMA,
100
100
  lang: parent._t.psv,
package/src/utils/API.js CHANGED
@@ -369,6 +369,22 @@ export default class API extends EventTarget {
369
369
  }
370
370
  }
371
371
 
372
+ /**
373
+ * Get the withCredentials function for PhotoSphereViewer to handle fetch credentials parameter.
374
+ * @memberOf Panoramax.utils.API#
375
+ * @private
376
+ * @returns {function} The withCredentials function
377
+ */
378
+ _getPSVWithCredentials() {
379
+ const fetchOpts = this._getFetchOptions();
380
+ if(fetchOpts.credentials === "include") {
381
+ return (url) => url.startsWith(this._endpoint);
382
+ }
383
+ else {
384
+ return undefined;
385
+ }
386
+ }
387
+
372
388
  /**
373
389
  * Get sequence GeoJSON representation
374
390
  * @memberOf Panoramax.utils.API#
@@ -10,6 +10,7 @@ const createParent = () => ({
10
10
  _t: { pnx: {} },
11
11
  api: {
12
12
  _getFetchOptions: jest.fn(),
13
+ _getPSVWithCredentials: () => false,
13
14
  getPictureMetadataUrl: (picId, seqId) => `https://geovisio.fr/api/collections/${seqId}/items/${picId}`
14
15
  },
15
16
  });