forked from MapComplete/MapComplete
Formatting
This commit is contained in:
parent
2883ae7122
commit
41ee3a7e58
1 changed files with 20 additions and 21 deletions
|
@ -16,12 +16,12 @@ export default class ShowDataLayer {
|
|||
private readonly _leafletMap: UIEventSource<L.Map>;
|
||||
private _cleanCount = 0;
|
||||
private readonly _enablePopups: boolean;
|
||||
private readonly _features : UIEventSource<{ feature: any, freshness: Date }[]>
|
||||
private readonly _features: UIEventSource<{ feature: any, freshness: Date }[]>
|
||||
|
||||
constructor(features: UIEventSource<{ feature: any, freshness: Date }[]>,
|
||||
leafletMap: UIEventSource<L.Map>,
|
||||
layoutToUse: UIEventSource<LayoutConfig>,
|
||||
enablePopups= true,
|
||||
enablePopups = true,
|
||||
zoomToFeatures = false) {
|
||||
this._leafletMap = leafletMap;
|
||||
this._enablePopups = enablePopups;
|
||||
|
@ -46,7 +46,7 @@ export default class ShowDataLayer {
|
|||
}
|
||||
const mp = leafletMap.data;
|
||||
|
||||
if(mp === undefined){
|
||||
if (mp === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ export default class ShowDataLayer {
|
|||
mp.addLayer(geoLayer)
|
||||
}
|
||||
|
||||
if(zoomToFeatures){
|
||||
if (zoomToFeatures) {
|
||||
mp.fitBounds(geoLayer.getBounds())
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,6 @@ export default class ShowDataLayer {
|
|||
}
|
||||
|
||||
|
||||
|
||||
private createStyleFor(feature) {
|
||||
const tagsSource = State.state.allElements.addOrGetElement(feature);
|
||||
// Every object is tied to exactly one layer
|
||||
|
@ -111,7 +110,7 @@ export default class ShowDataLayer {
|
|||
|
||||
const style = layer.GenerateLeafletStyle(tagSource, !(layer.title === undefined && (layer.tagRenderings ?? []).length === 0));
|
||||
const baseElement = style.icon.html;
|
||||
if(!this._enablePopups){
|
||||
if (!this._enablePopups) {
|
||||
baseElement.SetStyle("cursor: initial !important")
|
||||
}
|
||||
return L.marker(latLng, {
|
||||
|
@ -180,7 +179,7 @@ export default class ShowDataLayer {
|
|||
if (selected.properties.id === feature.properties.id) {
|
||||
// A small sanity check to prevent infinite loops:
|
||||
// If a feature is rendered both as way and as point, opening one popup might trigger the other to open, which might trigger the one to open again
|
||||
if(selected.geometry.type === feature.geometry.type){
|
||||
if (selected.geometry.type === feature.geometry.type) {
|
||||
leafletLayer.openPopup()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue