mirror of
https://github.com/heyarne/berliner-winter.git
synced 2026-05-06 19:23:39 +02:00
Put out linebreaks in popups
This commit is contained in:
parent
021afeb4a0
commit
07f80c0a3f
1 changed files with 18 additions and 22 deletions
|
|
@ -20,28 +20,6 @@ class Visualization {
|
||||||
this._markers = []
|
this._markers = []
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear the map and render new markers
|
|
||||||
* @param {Array[Object]} incidents The incidents to be shown
|
|
||||||
* @return {Visualization}
|
|
||||||
* @chainable
|
|
||||||
*/
|
|
||||||
displayMarkers (incidents) {
|
|
||||||
if (incidents == null)
|
|
||||||
incidents = this.data
|
|
||||||
|
|
||||||
this._markers.forEach(marker => { this.map.removeLayer(marker) })
|
|
||||||
this._markers = []
|
|
||||||
|
|
||||||
incidents.forEach(incident => {
|
|
||||||
this._markers.push(
|
|
||||||
this._createMarker(incident).bindPopup(incident.description)
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all currently active categories
|
* Gets all currently active categories
|
||||||
* @return {Array[string]}
|
* @return {Array[string]}
|
||||||
|
|
@ -127,6 +105,24 @@ class Visualization {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the map and render new markers
|
||||||
|
* @param {Array[Object]} incidents The incidents to be shown
|
||||||
|
* @return {Visualization}
|
||||||
|
* @chainable
|
||||||
|
*/
|
||||||
|
displayMarkers (incidents) {
|
||||||
|
if (incidents == null)
|
||||||
|
incidents = this.data
|
||||||
|
|
||||||
|
this._markers.forEach(marker => { this.map.removeLayer(marker) })
|
||||||
|
this._markers = incidents.map(incident => {
|
||||||
|
return this._createMarker(incident).bindPopup(incident.description.replace(/\n/g, '<br>'))
|
||||||
|
})
|
||||||
|
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the correct marker for a single incident and adds it to the map
|
* Creates the correct marker for a single incident and adds it to the map
|
||||||
* @param {Object} data A single incident
|
* @param {Object} data A single incident
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue