@panoramax/web-viewer 4.0.3-develop-a14de8c5 → 4.0.3-develop-a32876ba
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/index.js +3 -3
- package/build/index.js.map +1 -1
- package/config/jest/mocks.js +3 -1
- package/docs/reference/components/ui/Map.md +3 -2
- package/docs/reference/components/ui/MapMore.md +2 -2
- package/package.json +1 -1
- package/src/components/core/Editor.js +1 -0
- package/src/components/ui/Map.js +10 -3
- package/src/utils/map.js +1 -1
package/config/jest/mocks.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* [.onceLayerReady(layerId)](#Panoramax.components.ui.Map+onceLayerReady) ⇒ <code>Promise</code>
|
|
18
18
|
* [.setVisibleUsers(visibleIds)](#Panoramax.components.ui.Map+setVisibleUsers)
|
|
19
19
|
* [.filterUserLayersContent(dataType, filter)](#Panoramax.components.ui.Map+filterUserLayersContent)
|
|
20
|
-
* [.displayPictureMarker(lon, lat, heading, [skipCenter])](#Panoramax.components.ui.Map+displayPictureMarker)
|
|
20
|
+
* [.displayPictureMarker(lon, lat, heading, [skipCenter], [picId])](#Panoramax.components.ui.Map+displayPictureMarker)
|
|
21
21
|
* [.reloadLayersStyles()](#Panoramax.components.ui.Map+reloadLayersStyles)
|
|
22
22
|
* [.addEventListener(type, listener)](#Panoramax.components.ui.Map+addEventListener)
|
|
23
23
|
* [.setVisibleUsers(visibleIds)](#Panoramax.components.ui.Map+setVisibleUsers)
|
|
@@ -51,6 +51,7 @@ A shorthand `addEventListener` function is added for simpler usage.
|
|
|
51
51
|
| [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). |
|
|
52
52
|
| [options.background] | <code>string</code> | <code>"streets"</code> | Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street. |
|
|
53
53
|
| [options.attributionControl.customAttribution] | <code>string</code> | | To override default map attribution. |
|
|
54
|
+
| [options.picMarkerDraggable] | boolean | false | To make the picture marker draggable, default to false. |
|
|
54
55
|
|
|
55
56
|
**Example**
|
|
56
57
|
```js
|
|
@@ -148,7 +149,7 @@ Filter the visible data content in all visible map layers
|
|
|
148
149
|
|
|
149
150
|
<a name="Panoramax.components.ui.Map+displayPictureMarker"></a>
|
|
150
151
|
|
|
151
|
-
### map.displayPictureMarker(lon, lat, heading, [skipCenter])
|
|
152
|
+
### map.displayPictureMarker(lon, lat, heading, [skipCenter], [picId])
|
|
152
153
|
Shows on map a picture position and heading.
|
|
153
154
|
|
|
154
155
|
**Kind**: instance method of [<code>Map</code>](#Panoramax.components.ui.Map)
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* [.onceLayerReady(layerId)](Map.md/#Panoramax.components.ui.Map+onceLayerReady) ⇒ <code>Promise</code>
|
|
18
18
|
* [.setVisibleUsers(visibleIds)](Map.md/#Panoramax.components.ui.Map+setVisibleUsers)
|
|
19
19
|
* [.filterUserLayersContent(dataType, filter)](Map.md/#Panoramax.components.ui.Map+filterUserLayersContent)
|
|
20
|
-
* [.displayPictureMarker(lon, lat, heading, [skipCenter])](#Panoramax.components.ui.Map+displayPictureMarker)
|
|
20
|
+
* [.displayPictureMarker(lon, lat, heading, [skipCenter], [picId])](#Panoramax.components.ui.Map+displayPictureMarker)
|
|
21
21
|
* [.reloadLayersStyles()](Map.md/#Panoramax.components.ui.Map+reloadLayersStyles)
|
|
22
22
|
* [.addEventListener(type, listener)](Map.md/#Panoramax.components.ui.Map+addEventListener)
|
|
23
23
|
* ["filters-changed"](#Panoramax.components.ui.MapMore+event_filters-changed)
|
|
@@ -148,7 +148,7 @@ Filter the visible data content in all visible map layers
|
|
|
148
148
|
|
|
149
149
|
<a name="Panoramax.components.ui.Map+displayPictureMarker"></a>
|
|
150
150
|
|
|
151
|
-
### mapMore.displayPictureMarker(lon, lat, heading, [skipCenter])
|
|
151
|
+
### mapMore.displayPictureMarker(lon, lat, heading, [skipCenter], [picId])
|
|
152
152
|
Shows on map a picture position and heading.
|
|
153
153
|
|
|
154
154
|
**Kind**: instance method of [<code>MapMore</code>](#Panoramax.components.ui.MapMore)
|
package/package.json
CHANGED
|
@@ -149,6 +149,7 @@ export default class Editor extends Basic {
|
|
|
149
149
|
background: this.background,
|
|
150
150
|
supplementaryStyle: this._createMapStyle(),
|
|
151
151
|
zoom: 15, // Hack to avoid _initMapPosition call
|
|
152
|
+
picMarkerDraggable: true,
|
|
152
153
|
});
|
|
153
154
|
linkMapAndPhoto(this);
|
|
154
155
|
this.loader.setAttribute("value", 50);
|
package/src/components/ui/Map.js
CHANGED
|
@@ -37,6 +37,7 @@ maplibregl.addProtocol("pmtiles", new pmtiles.Protocol().tile);
|
|
|
37
37
|
* @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).
|
|
38
38
|
* @param {string} [options.background=streets] Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street.
|
|
39
39
|
* @param {string} [options.attributionControl.customAttribution] To override default map attribution.
|
|
40
|
+
* @param {boolean} [options.picMarkerDraggable] To make the picture marker draggable, default to false.
|
|
40
41
|
* @fires Panoramax.components.ui.Map#background-changed
|
|
41
42
|
* @fires Panoramax.components.ui.Map#users-changed
|
|
42
43
|
* @fires Panoramax.components.ui.Map#sequence-hover
|
|
@@ -421,8 +422,9 @@ export default class Map extends maplibregl.Map {
|
|
|
421
422
|
* @param {number} lat The latitude
|
|
422
423
|
* @param {number} heading The heading
|
|
423
424
|
* @param {boolean} [skipCenter=false] Set to true to avoid map centering on marker
|
|
425
|
+
* @param {string} picId The picture Id
|
|
424
426
|
*/
|
|
425
|
-
displayPictureMarker(lon, lat, heading, skipCenter = false) {
|
|
427
|
+
displayPictureMarker(lon, lat, heading, skipCenter = false, picId = null) {
|
|
426
428
|
this._picMarkerPreview.remove();
|
|
427
429
|
|
|
428
430
|
// Show marker corresponding to selection
|
|
@@ -431,6 +433,7 @@ export default class Map extends maplibregl.Map {
|
|
|
431
433
|
.setLngLat([lon, lat])
|
|
432
434
|
.setRotation(heading)
|
|
433
435
|
.addTo(this);
|
|
436
|
+
this._picMarker.picId = picId ;
|
|
434
437
|
}
|
|
435
438
|
else {
|
|
436
439
|
this._picMarker.remove();
|
|
@@ -880,8 +883,12 @@ export default class Map extends maplibregl.Map {
|
|
|
880
883
|
img.src = selected ? MarkerSelectedSVG : MarkerBaseSVG;
|
|
881
884
|
img.alt = "";
|
|
882
885
|
return new maplibregl.Marker({
|
|
883
|
-
element: img
|
|
884
|
-
|
|
886
|
+
element: img,
|
|
887
|
+
picId: null
|
|
888
|
+
})
|
|
889
|
+
// only picMarker could be draggable, don't for picMarkerPreview.
|
|
890
|
+
.setDraggable(selected && this._options.picMarkerDraggable)
|
|
891
|
+
;
|
|
885
892
|
}
|
|
886
893
|
|
|
887
894
|
/**
|
package/src/utils/map.js
CHANGED
|
@@ -408,7 +408,7 @@ export function linkMapAndPhoto(parent) {
|
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
else {
|
|
411
|
-
parent.map.displayPictureMarker(e.detail.lon, e.detail.lat, parent.psv.getXY().x, e.detail.first);
|
|
411
|
+
parent.map.displayPictureMarker(e.detail.lon, e.detail.lat, parent.psv.getXY().x, e.detail.first, e.detail.picId);
|
|
412
412
|
if(parent?.isMapWide?.()) {
|
|
413
413
|
parent?.mini?.removeAttribute("collapsed");
|
|
414
414
|
}
|