@panoramax/web-viewer 4.3.1-develop-2767771b → 4.3.1-develop-2084d822

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.3.1-develop-2767771b",
3
+ "version": "4.3.1-develop-2084d822",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -2,7 +2,7 @@ import { LitElement, html, css } from "lit";
2
2
  import { fa } from "../../utils/widgets";
3
3
  import { faInfoCircle } from "@fortawesome/free-solid-svg-icons/faInfoCircle";
4
4
  import { faDownload } from "@fortawesome/free-solid-svg-icons/faDownload";
5
- import { SEMANTICS_OVERLAY_ZOOM } from "../../utils/SemanticsMapProtocol";
5
+ import { SEMANTICS_OVERLAY_MINZOOM } from "../../utils/SemanticsMapProtocol";
6
6
  import { onceParentAvailable } from "../../utils/widgets";
7
7
 
8
8
  /**
@@ -104,7 +104,7 @@ export default class SemanticsFilters extends LitElement {
104
104
  * @private
105
105
  */
106
106
  _onMapZoom() {
107
- this._showZoomIn = this._parent.map.getZoom() < SEMANTICS_OVERLAY_ZOOM;
107
+ this._showZoomIn = this._parent.map.getZoom() < SEMANTICS_OVERLAY_MINZOOM;
108
108
  }
109
109
 
110
110
  /** @private */
@@ -495,17 +495,31 @@ export default class Map extends maplibregl.Map {
495
495
  });
496
496
  }
497
497
 
498
+ /**
499
+ * Get the ID of the first Panoramax sequence/picture layer.
500
+ * Useful for addLayer's beforeId parameter.
501
+ * @returns {string} First Panoramax sequence layer ID
502
+ */
503
+ getFirstPictureLayerID() {
504
+ return this.getLayersOrder().find(l => l.startsWith("geovisio_") || l.endsWith("_sequences"));
505
+ }
506
+
498
507
  /**
499
508
  * Adds a new map layer.
500
509
  * This is an override of MapLibre's addLayer function in order to make sure all layers without beforeId are put between map background and Panoramax data.
501
510
  */
502
- addLayer(layer, beforeId) {
503
- // If no beforeId defined, make sure to put this behind Panoramax own layers
504
- beforeId = beforeId || (
505
- this._options.raster ?
506
- RASTER_LAYER_ID :
507
- this.getLayersOrder().find(l => l.startsWith("geovisio_") || l.endsWith("_sequences"))
508
- );
511
+ addLayer(layer, beforeId, beforeSequences = true) {
512
+ // Override beforeId to insert either before or after Panoramax own layers
513
+ if(!beforeId && beforeSequences) {
514
+ // Do not change for own Panoramax layers or semantics layers
515
+ if(
516
+ !layer.id.startsWith("geovisio_")
517
+ && layer.id !== RASTER_LAYER_ID
518
+ && !layer.source.startsWith("sem-")
519
+ ) {
520
+ beforeId = this.getFirstPictureLayerID();
521
+ }
522
+ }
509
523
 
510
524
  super.addLayer(layer, beforeId);
511
525
  }
@@ -5,7 +5,7 @@ import {
5
5
  mapFiltersToLayersFilters, MAP_EXPR_QUALITYSCORE_GPS
6
6
  } from "../../utils/map";
7
7
  import { SEMANTICS_OVERLAYS } from "../../utils/semantics";
8
- import { SEMANTICS_OVERLAY_ZOOM } from "../../utils/SemanticsMapProtocol";
8
+ import { SEMANTICS_OVERLAY_MINZOOM, SEMANTICS_OVERLAY_MAXZOOM } from "../../utils/SemanticsMapProtocol";
9
9
  import { getUserAccount } from "../../utils/utils";
10
10
 
11
11
  export const MAP_FILTERS = [ "minDate", "maxDate", "pic_type", "camera", "theme", "qualityscore", "gps"];
@@ -358,8 +358,8 @@ export default class MapMore extends Map {
358
358
  this.addSource(srcId, {
359
359
  type: "vector",
360
360
  tiles: [`sem:///${apiFilter}/{z}/{x}/{y}`],
361
- minzoom: SEMANTICS_OVERLAY_ZOOM,
362
- maxzoom: SEMANTICS_OVERLAY_ZOOM
361
+ minzoom: SEMANTICS_OVERLAY_MINZOOM,
362
+ maxzoom: SEMANTICS_OVERLAY_MAXZOOM
363
363
  });
364
364
  this.addLayer({
365
365
  id,
@@ -104,7 +104,7 @@ export default class Photo extends PSViewer {
104
104
  showErrorTile: false,
105
105
  baseBlur: false,
106
106
  resolution: parent.isWidthSmall() ? 32 : 64,
107
- shouldGoFast: options.shouldGoFast,
107
+ shouldGoFast: options?.shouldGoFast || (() => false),
108
108
  useXmpData: false,
109
109
  }],
110
110
  withCredentials: parent.api._getPSVWithCredentials(),
@@ -1,7 +1,9 @@
1
1
  import geojsonvt from "geojson-vt";
2
2
  import { fromGeojsonVt } from "@maplibre/vt-pbf";
3
3
 
4
- export const SEMANTICS_OVERLAY_ZOOM = 15;
4
+ export const SEMANTICS_OVERLAY_MINZOOM = 15;
5
+ export const SEMANTICS_OVERLAY_MAXZOOM = 19;
6
+ const LIMIT_PER_ZOOM = { 15: 100, 16: 300, 17: 500, 18: 800, 19: 1000 };
5
7
 
6
8
  /**
7
9
  * Semantics Map Protocol adds a new URI scheme "sem://" to MapLibre.
@@ -86,7 +88,7 @@ export default class SemanticsMapProtocol {
86
88
 
87
89
  // Download from API
88
90
  const bbox = this._tileToBbox(parseInt(x), parseInt(y), parseInt(z));
89
- const url = `${this.api._endpoint}/search?bbox=${bbox.join(",")}&limit=1000&filter=${encodeURIComponent(f)}`;
91
+ const url = `${this.api._endpoint}/search?bbox=${bbox.join(",")}&limit=${LIMIT_PER_ZOOM[parseInt(z)]}&sortby=id&filter=${encodeURIComponent(f)}`;
90
92
  return fetch(url, { signal: abort.signal })
91
93
  .then(res => res.json())
92
94
  .then(geojson => {
@@ -110,7 +112,7 @@ export default class SemanticsMapProtocol {
110
112
  }
111
113
 
112
114
  // Transform GeoJSON into MVT
113
- const tileIndex = geojsonvt(geojson, {maxZoom: SEMANTICS_OVERLAY_ZOOM});
115
+ const tileIndex = geojsonvt(geojson, {minZoom: SEMANTICS_OVERLAY_MINZOOM, maxZoom: SEMANTICS_OVERLAY_MAXZOOM});
114
116
  const tile = tileIndex.getTile(z, x, y);
115
117
  if(!tile) { throw new Error("Can't create tile"); }
116
118
  const mvt = fromGeojsonVt({ layer: tile }, { version: 2 });