@panoramax/web-viewer 3.2.3-develop-d0806c5a → 3.2.3-develop-e277ccb9

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.
@@ -38,6 +38,22 @@ In order to offer a coherent overlay of widgets, we follow this general `z-index
38
38
  | Togglable menus | 130 |
39
39
  | Fullscreen loaders & popups | 200 |
40
40
 
41
+ ### Parameters handling
42
+
43
+ !!! note
44
+
45
+ This concerns only __Viewer__ component. Editor & Coverage Map read input parameters only from Web Components attributes.
46
+
47
+ Viewer component can read parameters from 3 different sources:
48
+
49
+ - Web Component __attributes__, passed through DOM
50
+ - Browser __local storage__
51
+ - __URL search__ parameters
52
+
53
+ This allows a flexible way to interact with viewer for users. Prioritization of parameters is managed by [InitParameters class](./reference/utils/InitParameters.md), URL parameters coming first, then local storage, to fallback with Web component attributes (and eventually some hard-coded defaults).
54
+
55
+ This means that, when developing, if you want to check if your attributes are well-defined, you may want to get rid of URL search parameters, as well as remove the `pnx-map-parameters` local storage item. Otherwise, they may not be read as they are lower priority than others.
56
+
41
57
  ## Testing
42
58
 
43
59
  We're trying to make Panoramax as reliable and secure as possible. To ensure this, we rely heavily on code testing. A variety of testing tools is made available:
@@ -42,13 +42,13 @@ Component properties.
42
42
 
43
43
  | Name | Type | Default | Description |
44
44
  | --- | --- | --- | --- |
45
+ | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
45
46
  | [picture] | <code>string</code> | | The picture ID to display |
46
47
  | [sequence] | <code>string</code> | | The sequence ID of the picture displayed |
47
48
  | [fetchOptions] | <code>object</code> | | Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters)) |
48
49
  | [users] | <code>Array.&lt;string&gt;</code> | <code>[geovisio]</code> | List of users IDs to use for map display (defaults to general map, identified as "geovisio") |
49
50
  | [mapstyle] | <code>string</code> \| <code>object</code> | | The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles. |
50
51
  | [lang] | <code>string</code> | | To override language used for labels. Defaults to using user's preferred languages. |
51
- | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
52
52
 
53
53
  <a name="Panoramax.components.core.Basic+onceReady"></a>
54
54
 
@@ -16,7 +16,7 @@
16
16
 
17
17
  * [.CoverageMap](#Panoramax.components.core.CoverageMap) ⇐ [<code>Basic</code>](Basic.md/#Panoramax.components.core.Basic)
18
18
  * [new CoverageMap()](#new_Panoramax.components.core.CoverageMap_new)
19
- * [.properties](Basic.md/#Panoramax.components.core.Basic+properties) : <code>Object</code>
19
+ * [.properties](#Panoramax.components.core.CoverageMap+properties) : <code>Object</code>
20
20
  * [.onceReady()](Basic.md/#Panoramax.components.core.Basic+onceReady) ⇒ <code>Promise</code>
21
21
  * [.onceAPIReady()](Basic.md/#Panoramax.components.core.Basic+onceAPIReady) ⇒ <code>Promise</code>
22
22
  * [.getClassName()](Basic.md/#Panoramax.components.core.Basic+getClassName) ⇒ <code>string</code>
@@ -37,25 +37,29 @@ Coverage Map is a basic map showing Panoramax coverage.
37
37
  ```html
38
38
  <pnx-coverage-map
39
39
  endpoint="https://panoramax.openstreetmap.fr/"
40
+ map='{"bounds": [[-73.9876, 40.7661], [-73.9397, 40.8002]]}'
40
41
  />
41
42
  ```
42
- <a name="Panoramax.components.core.Basic+properties"></a>
43
+ <a name="Panoramax.components.core.CoverageMap+properties"></a>
43
44
 
44
45
  ### coverageMap.properties : <code>Object</code>
45
46
  Component properties.
46
47
 
47
- **Kind**: instance mixin of [<code>CoverageMap</code>](#Panoramax.components.core.CoverageMap)
48
+ **Kind**: instance property of [<code>CoverageMap</code>](#Panoramax.components.core.CoverageMap)
49
+ **Mixes**: [<code>properties</code>](Basic.md/#Panoramax.components.core.Basic+properties)
50
+ **Overrides**: [<code>properties</code>](Basic.md/#Panoramax.components.core.Basic+properties)
48
51
  **Properties**
49
52
 
50
53
  | Name | Type | Default | Description |
51
54
  | --- | --- | --- | --- |
55
+ | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
52
56
  | [picture] | <code>string</code> | | The picture ID to display |
53
57
  | [sequence] | <code>string</code> | | The sequence ID of the picture displayed |
54
58
  | [fetchOptions] | <code>object</code> | | Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters)) |
55
59
  | [users] | <code>Array.&lt;string&gt;</code> | <code>[geovisio]</code> | List of users IDs to use for map display (defaults to general map, identified as "geovisio") |
56
60
  | [mapstyle] | <code>string</code> \| <code>object</code> | | The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles. |
57
61
  | [lang] | <code>string</code> | | To override language used for labels. Defaults to using user's preferred languages. |
58
- | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
62
+ | [map] | <code>object</code> | | [Any map option available in Map class](../ui/Map.md/#Panoramax.components.ui.Map).<br />Example: `map='{"bounds": [[-73.9876, 40.7661], [-73.9397, 40.8002]]}'` |
59
63
 
60
64
  <a name="Panoramax.components.core.Basic+onceReady"></a>
61
65
 
@@ -54,13 +54,13 @@ Component properties. All of [Basic properties](Basic.md/#Panoramax.components.c
54
54
 
55
55
  | Name | Type | Default | Description |
56
56
  | --- | --- | --- | --- |
57
+ | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
57
58
  | [picture] | <code>string</code> | | The picture ID to display |
58
59
  | [sequence] | <code>string</code> | | The sequence ID of the picture displayed |
59
60
  | [fetchOptions] | <code>object</code> | | Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters)) |
60
61
  | [users] | <code>Array.&lt;string&gt;</code> | <code>[geovisio]</code> | List of users IDs to use for map display (defaults to general map, identified as "geovisio") |
61
62
  | [mapstyle] | <code>string</code> \| <code>object</code> | | The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles. |
62
63
  | [lang] | <code>string</code> | | To override language used for labels. Defaults to using user's preferred languages. |
63
- | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
64
64
  | [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). |
65
65
  | [background] | <code>string</code> | <code>&quot;streets&quot;</code> | Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street. |
66
66
 
@@ -79,6 +79,12 @@ This component has a [CorneredGrid](../layout/CorneredGrid.md/#Panoramax.compone
79
79
  >
80
80
  <p slot="top-right">My custom text</p>
81
81
  </pnx-viewer>
82
+
83
+ <!-- With map options -->
84
+ <pnx-viewer
85
+ endpoint="https://panoramax.openstreetmap.fr/"
86
+ map="{'maxZoom': 15, 'background': 'aerial', 'raster': '...'}"
87
+ />
82
88
  ```
83
89
  <a name="Panoramax.components.core.Viewer+properties"></a>
84
90
 
@@ -92,8 +98,9 @@ Component properties. All of [Basic properties](Basic.md/#Panoramax.components.c
92
98
 
93
99
  | Name | Type | Default | Description |
94
100
  | --- | --- | --- | --- |
95
- | [map] | <code>boolean</code> \| <code>object</code> | <code>true</code> | Should map be used (true/false), or an object with [any map option available in Map class](../ui/MapMore.md/#Panoramax.components.ui.MapMore) |
96
- | [psv] | <code>object</code> | | [Any option to pass to Photo component](../ui/Photo.md/#Panoramax.components.ui.Photo) as an object |
101
+ | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
102
+ | [map] | <code>boolean</code> \| <code>object</code> | <code>true</code> | Should map be used (true/false), or an object with [any map option available in Map or MapMore class](../ui/MapMore.md/#Panoramax.components.ui.MapMore).<br />Example: `map="{'background': 'aerial', 'theme': 'age'}"` |
103
+ | [psv] | <code>object</code> | | [Any option to pass to Photo component](../ui/Photo.md/#Panoramax.components.ui.Photo) as an object.<br />Example: `psv="{'transitionDuration': 500, 'picturesNavigation': 'pic'}"` |
97
104
  | [url-parameters] | <code>string</code> | <code>true</code> | Should the component add and update URL query parameters to save viewer state ? |
98
105
  | [focus] | <code>string</code> | <code>&quot;pic&quot;</code> | The component showing up as main component (pic, map) |
99
106
  | [geocoder] | <code>string</code> | <code>&quot;nominatim&quot;</code> | The geocoder engine to use (nominatim, ban) |
@@ -104,7 +111,6 @@ Component properties. All of [Basic properties](Basic.md/#Panoramax.components.c
104
111
  | [users] | <code>Array.&lt;string&gt;</code> | <code>[geovisio]</code> | List of users IDs to use for map display (defaults to general map, identified as "geovisio") |
105
112
  | [mapstyle] | <code>string</code> \| <code>object</code> | | The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles. |
106
113
  | [lang] | <code>string</code> | | To override language used for labels. Defaults to using user's preferred languages. |
107
- | endpoint | <code>string</code> | | URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md)) |
108
114
 
109
115
  <a name="Panoramax.components.core.Viewer+onceReady"></a>
110
116
 
@@ -45,6 +45,7 @@ It uses instead [`on`](https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/
45
45
  | [options] | <code>object</code> | | The map options (any of [MapLibre GL settings](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MapOptions/) or any supplementary option defined here) |
46
46
  | [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). |
47
47
  | [options.background] | <code>string</code> | <code>&quot;streets&quot;</code> | Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street. |
48
+ | [options.attributionControl.customAttribution] | <code>string</code> | | To override default map attribution. |
48
49
 
49
50
  **Example**
50
51
  ```js
@@ -25,3 +25,15 @@ Note that we also support PMTiles (for a simpler tile hosting), so your style fi
25
25
  }'
26
26
  />
27
27
  ```
28
+
29
+ And you can also customize the map attribution, especially if your style JSON doesn't contain any by default, for example:
30
+
31
+ ```html
32
+ <pnx-viewer
33
+ endpoint="https://api.panoramax.xyz/api"
34
+ mapstyle="https://my.tiles.provider/basic.json"
35
+ map='{
36
+ "attributionControl": { "customAttribution": "&copy; IGN" }
37
+ }'
38
+ />
39
+ ```
@@ -132,3 +132,7 @@ URL parameters are now managed in the URL _search_ part (everything after the `?
132
132
  ```urlencoded
133
133
  https://panoramax.ign.fr/?background=streets&focus=map&map=9/48.6659/2.3237&speed=250
134
134
  ```
135
+
136
+ ## 🪛 Initialization parameters
137
+
138
+ Parameters passed to __Viewer__ are more finely read, they can come from Web Component itself (attributes), browser local storage or URL search parameters. URL ones are read first, then local storage, and finally component attributes. This can be misleading while you develop, [read more about this on Develop documentation](../09_Develop.md#parameters-handling).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "3.2.3-develop-d0806c5a",
3
+ "version": "3.2.3-develop-e277ccb9",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -33,13 +33,13 @@ export default class Basic extends LitElement {
33
33
  * @memberof Panoramax.components.core.Basic#
34
34
  * @type {Object}
35
35
  * @mixin
36
+ * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
36
37
  * @property {string} [picture] The picture ID to display
37
38
  * @property {string} [sequence] The sequence ID of the picture displayed
38
39
  * @property {object} [fetchOptions] Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters))
39
40
  * @property {string[]} [users=[geovisio]] List of users IDs to use for map display (defaults to general map, identified as "geovisio")
40
41
  * @property {string|object} [mapstyle] The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles.
41
42
  * @property {string} [lang] To override language used for labels. Defaults to using user's preferred languages.
42
- * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
43
43
  */
44
44
  static properties = {
45
45
  picture: {type: String, reflect: true},
@@ -3,6 +3,7 @@ import Map from "../ui/Map";
3
3
  import { getUserLayerId } from "../../utils/map";
4
4
  import { NavigationControl } from "!maplibre-gl"; // DO NOT REMOVE THE "!": bundled builds breaks otherwise !!!
5
5
  import "./CoverageMap.css";
6
+ import { default as InitParameters, alterMapState } from "../../utils/InitParameters";
6
7
 
7
8
 
8
9
  /**
@@ -20,16 +21,37 @@ import "./CoverageMap.css";
20
21
  * ```html
21
22
  * <pnx-coverage-map
22
23
  * endpoint="https://panoramax.openstreetmap.fr/"
24
+ * map='{"bounds": [[-73.9876, 40.7661], [-73.9397, 40.8002]]}'
23
25
  * />
24
26
  * ```
25
27
  */
26
28
  export default class CoverageMap extends Basic {
29
+ /**
30
+ * Component properties.
31
+ * @memberof Panoramax.components.core.CoverageMap#
32
+ * @type {Object}
33
+ * @mixes Panoramax.components.core.Basic#properties
34
+ * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
35
+ * @property {string} [picture] The picture ID to display
36
+ * @property {string} [sequence] The sequence ID of the picture displayed
37
+ * @property {object} [fetchOptions] Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters))
38
+ * @property {string[]} [users=[geovisio]] List of users IDs to use for map display (defaults to general map, identified as "geovisio")
39
+ * @property {string|object} [mapstyle] The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles.
40
+ * @property {string} [lang] To override language used for labels. Defaults to using user's preferred languages.
41
+ * @property {object} [map] [Any map option available in Map class](#Panoramax.components.ui.Map).<br />Example: `map='{"bounds": [[-73.9876, 40.7661], [-73.9397, 40.8002]]}'`
42
+ */
43
+ static properties = {
44
+ map: {type: Object},
45
+ ...Basic.properties
46
+ };
47
+
27
48
  constructor() {
28
49
  super();
29
50
 
30
51
  this._mapContainer = document.createElement("div");
31
52
  this.onceAPIReady().then(() => {
32
53
  this.loader.setAttribute("value", 30);
54
+ this._initParams = new InitParameters(InitParameters.GetComponentProperties(CoverageMap, this));
33
55
  this._initMap();
34
56
  });
35
57
 
@@ -60,8 +82,6 @@ export default class CoverageMap extends Basic {
60
82
  * @private
61
83
  */
62
84
  _initMap() {
63
- const mapOptions = { hash: true };
64
-
65
85
  // Override to avoid display of pictures symbols
66
86
  class MyMap extends Map {
67
87
  _getLayerStyleProperties(layer) {
@@ -74,10 +94,11 @@ export default class CoverageMap extends Basic {
74
94
  }
75
95
  }
76
96
 
77
- this.map = new MyMap(this, this._mapContainer, mapOptions);
97
+ this.map = new MyMap(this, this._mapContainer, Object.assign({}, this._initParams.getMapInit(), { hash: true }));
78
98
  this.map.addControl(new NavigationControl({ showCompass: false }));
79
99
  this.loader.setAttribute("value", 70);
80
100
  this.map.waitForEnoughMapLoaded().then(() => {
101
+ alterMapState(this.map, this._initParams.getMapPostInit());
81
102
  this.map.reloadLayersStyles();
82
103
  this.loader.dismiss();
83
104
  });
@@ -40,13 +40,13 @@ export default class Editor extends Basic {
40
40
  * @memberof Panoramax.components.core.Editor#
41
41
  * @mixes Panoramax.components.core.Basic#properties
42
42
  * @type {Object}
43
+ * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
43
44
  * @property {string} [picture] The picture ID to display
44
45
  * @property {string} [sequence] The sequence ID of the picture displayed
45
46
  * @property {object} [fetchOptions] Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters))
46
47
  * @property {string[]} [users=[geovisio]] List of users IDs to use for map display (defaults to general map, identified as "geovisio")
47
48
  * @property {string|object} [mapstyle] The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles.
48
49
  * @property {string} [lang] To override language used for labels. Defaults to using user's preferred languages.
49
- * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
50
50
  * @property {object} [raster] 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).
51
51
  * @property {string} [background=streets] Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street.
52
52
  */
@@ -69,6 +69,12 @@ const MAP_MOVE_DELTA = 100;
69
69
  * >
70
70
  * <p slot="top-right">My custom text</p>
71
71
  * </pnx-viewer>
72
+ *
73
+ * <!-- With map options -->
74
+ * <pnx-viewer
75
+ * endpoint="https://panoramax.openstreetmap.fr/"
76
+ * map="{'maxZoom': 15, 'background': 'aerial', 'raster': '...'}"
77
+ * />
72
78
  * ```
73
79
  */
74
80
  export default class Viewer extends Basic {
@@ -77,8 +83,9 @@ export default class Viewer extends Basic {
77
83
  * @memberof Panoramax.components.core.Viewer#
78
84
  * @mixes Panoramax.components.core.Basic#properties
79
85
  * @type {Object}
80
- * @property {boolean|object} [map=true] Should map be used (true/false), or an object with [any map option available in Map class](#Panoramax.components.ui.MapMore)
81
- * @property {object} [psv] [Any option to pass to Photo component](#Panoramax.components.ui.Photo) as an object
86
+ * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
87
+ * @property {boolean|object} [map=true] Should map be used (true/false), or an object with [any map option available in Map or MapMore class](#Panoramax.components.ui.MapMore).<br />Example: `map="{'background': 'aerial', 'theme': 'age'}"`
88
+ * @property {object} [psv] [Any option to pass to Photo component](#Panoramax.components.ui.Photo) as an object.<br />Example: `psv="{'transitionDuration': 500, 'picturesNavigation': 'pic'}"`
82
89
  * @property {string} [url-parameters=true] Should the component add and update URL query parameters to save viewer state ?
83
90
  * @property {string} [focus=pic] The component showing up as main component (pic, map)
84
91
  * @property {string} [geocoder=nominatim] The geocoder engine to use (nominatim, ban)
@@ -89,7 +96,6 @@ export default class Viewer extends Basic {
89
96
  * @property {string[]} [users=[geovisio]] List of users IDs to use for map display (defaults to general map, identified as "geovisio")
90
97
  * @property {string|object} [mapstyle] The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles.
91
98
  * @property {string} [lang] To override language used for labels. Defaults to using user's preferred languages.
92
- * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
93
99
  */
94
100
  static properties = {
95
101
  map: {type: Object},
@@ -46,7 +46,7 @@ export default class MapLegend extends LitElement {
46
46
  </pnx-link-button>
47
47
  </div>
48
48
  </div>
49
- ${mapAttrib ? html`${this._parent?._t.map.map_data}<br />${mapAttrib}` : nothing}
49
+ ${mapAttrib && mapAttrib.innerHTML.length > 0 ? html`${this._parent?._t.map.map_data}<br />${mapAttrib}` : nothing}
50
50
  `;
51
51
  }
52
52
  }
@@ -17,20 +17,6 @@ import * as pmtiles from "pmtiles";
17
17
  maplibregl.workerClass = maplibreglWorker;
18
18
  maplibregl.addProtocol("pmtiles", new pmtiles.Protocol().tile);
19
19
 
20
- const MAPLIBRE_OPTIONS = [ // No "style" option as it's handled by combineStyles function
21
- "antialias", "attributionControl", "bearing", "bearingSnap", "bounds",
22
- "boxZoom", "center", "clickTolerance", "collectResourceTiming",
23
- "cooperativeGestures", "crossSourceCollisions", "doubleClickZoom", "dragPan",
24
- "dragRotate", "fadeDuration", "failIfMajorPerformanceCaveat", "fitBoundsOptions",
25
- "hash", "interactive", "keyboard", "localIdeographFontFamily", "locale", "logoPosition",
26
- "maplibreLogo", "maxBounds", "maxCanvasSize", "maxPitch", "maxTileCacheSize",
27
- "maxTileCacheZoomLevels", "maxZoom", "minPitch", "minZoom", "pitch", "pitchWithRotate",
28
- "pixelRatio", "preserveDrawingBuffer", "refreshExpiredTiles", "renderWorldCopies",
29
- "scrollZoom", "touchPitch", "touchZoomRotate", "trackResize",
30
- "transformCameraUpdate", "transformRequest", "validateStyle", "zoom"
31
- ];
32
- const filterMapLibreOptions = opts => Object.fromEntries(Object.entries(opts).filter(([key]) => MAPLIBRE_OPTIONS.includes(key)));
33
-
34
20
 
35
21
  /**
36
22
  * Map is the component showing pictures and sequences geolocation.
@@ -49,6 +35,7 @@ const filterMapLibreOptions = opts => Object.fromEntries(Object.entries(opts).fi
49
35
  * @param {object} [options] The map options (any of [MapLibre GL settings](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MapOptions/) or any supplementary option defined here)
50
36
  * @param {object} [options.raster] 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).
51
37
  * @param {string} [options.background=streets] Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street.
38
+ * @param {string} [options.attributionControl.customAttribution] To override default map attribution.
52
39
  * @fires Panoramax.components.ui.Map#background-changed
53
40
  * @fires Panoramax.components.ui.Map#users-changed
54
41
  * @fires Panoramax.components.ui.Map#sequence-hover
@@ -77,7 +64,7 @@ export default class Map extends maplibregl.Map {
77
64
  transformRequest: parent.api._getMapRequestTransform(),
78
65
  locale: parent._t.maplibre,
79
66
  hash: false,
80
- ...filterMapLibreOptions(options)
67
+ ...options
81
68
  });
82
69
  this._loadMarkerImages();
83
70
 
@@ -95,7 +82,7 @@ export default class Map extends maplibregl.Map {
95
82
  this._options.background = this._options.background || "streets";
96
83
  }
97
84
 
98
- this._attribution = new maplibregl.AttributionControl({ compact: false });
85
+ this._attribution = new maplibregl.AttributionControl({ compact: false, ...options.attributionControl });
99
86
  this.addControl(this._attribution);
100
87
 
101
88
  this._initMapPosition();
@@ -10,6 +10,24 @@ export const MAP_FILTERS_JS2URL = {
10
10
  const MAP_FILTERS_URL2JS = Object.fromEntries(Object.entries(MAP_FILTERS_JS2URL).map(v => [v[1], v[0]]));
11
11
  const MAP_NONE = ["none", "null", "false", false];
12
12
 
13
+ const MAPLIBRE_OPTIONS = [
14
+ "antialias", "bearing", "bearingSnap", "bounds",
15
+ "boxZoom", "clickTolerance", "collectResourceTiming",
16
+ "cooperativeGestures", "crossSourceCollisions", "doubleClickZoom", "dragPan",
17
+ "dragRotate", "fadeDuration", "failIfMajorPerformanceCaveat", "fitBoundsOptions",
18
+ "hash", "interactive", "keyboard", "localIdeographFontFamily", "locale", "logoPosition",
19
+ "maplibreLogo", "maxBounds", "maxCanvasSize", "maxPitch", "maxTileCacheSize",
20
+ "maxTileCacheZoomLevels", "maxZoom", "minPitch", "minZoom", "pitch", "pitchWithRotate",
21
+ "pixelRatio", "preserveDrawingBuffer", "refreshExpiredTiles", "renderWorldCopies",
22
+ "scrollZoom", "touchPitch", "touchZoomRotate", "trackResize",
23
+ "transformCameraUpdate", "transformRequest", "validateStyle"
24
+ ];
25
+
26
+ function filterMapLibreOptions(opts) {
27
+ return Object.fromEntries(Object.entries(opts).filter(([key]) => MAPLIBRE_OPTIONS.includes(key)));
28
+ }
29
+
30
+
13
31
  /**
14
32
  * Merges all URL parameters and component attributes into a single set of coherent settings.
15
33
  *
@@ -50,7 +68,6 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
50
68
  let map_zoom = urlMap?.zoom || browserMap?.zoom || componentMap.zoom;
51
69
  let map_pitch = urlMap?.pitch || componentMap.pitch;
52
70
  let map_bearing = urlMap?.bearing || componentMap.bearing;
53
- console.log(componentMap);
54
71
 
55
72
  // - Component only
56
73
  let geocoder = componentAttrs.geocoder;
@@ -61,6 +78,8 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
61
78
  let lang = componentAttrs.lang;
62
79
  let endpoint = componentAttrs.endpoint;
63
80
  let map_raster = componentMap.raster;
81
+ let map_attribution = componentMap.attributionControl;
82
+ let map_others = filterMapLibreOptions(componentMap);
64
83
 
65
84
  // - URL only
66
85
  let psv_xyz = urlParams.xyz;
@@ -102,7 +121,11 @@ export default class InitParameters { // eslint-disable-line import/no-unused-mo
102
121
  };
103
122
  this._psvPostInit = { xyz: psv_xyz };
104
123
 
105
- this._mapInit = { raster: map_raster };
124
+ this._mapInit = {
125
+ raster: map_raster,
126
+ attributionControl: map_attribution,
127
+ ...map_others
128
+ };
106
129
  this._mapAny = {
107
130
  theme: map_theme,
108
131
  background: map_background,
@@ -311,7 +334,7 @@ export function alterMapState(map, params) {
311
334
  map.setVisibleUsers(vu);
312
335
 
313
336
  // Change map filters
314
- map.setFilters(paramsToMapFilters(params));
337
+ map.setFilters?.(paramsToMapFilters(params));
315
338
 
316
339
  // Change map background
317
340
  if(["aerial", "streets"].includes(params.background)) {