mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
Merge pull request #1938 from umap-project/1934-empty-map-datalayers
fix: Distinction between clearing data vs. layers
This commit is contained in:
commit
921bed1d99
1 changed files with 17 additions and 11 deletions
|
@ -13,7 +13,7 @@ L.Map.mergeOptions({
|
|||
// we cannot rely on this because of the y is overriden by Leaflet
|
||||
// See https://github.com/Leaflet/Leaflet/pull/9201
|
||||
// And let's remove this -y when this PR is merged and released.
|
||||
demoTileInfos: { 's': 'a', 'z': 9, 'x': 265, 'y': 181, '-y': 181, 'r': '' },
|
||||
demoTileInfos: { s: 'a', z: 9, x: 265, y: 181, '-y': 181, r: '' },
|
||||
licences: [],
|
||||
licence: '',
|
||||
enableMarkerDraw: true,
|
||||
|
@ -1505,8 +1505,15 @@ U.Map = L.Map.extend({
|
|||
L.DomUtil.createButton(
|
||||
'button umap-empty',
|
||||
advancedButtons,
|
||||
L._('Empty'),
|
||||
this.empty,
|
||||
L._('Clear data'),
|
||||
this.emptyDataLayers,
|
||||
this
|
||||
)
|
||||
L.DomUtil.createButton(
|
||||
'button umap-empty',
|
||||
advancedButtons,
|
||||
L._('Remove layers'),
|
||||
this.removeDataLayers,
|
||||
this
|
||||
)
|
||||
}
|
||||
|
@ -1517,13 +1524,6 @@ U.Map = L.Map.extend({
|
|||
this.clone,
|
||||
this
|
||||
)
|
||||
L.DomUtil.createButton(
|
||||
'button umap-empty',
|
||||
advancedButtons,
|
||||
L._('Delete all layers'),
|
||||
this.empty,
|
||||
this
|
||||
)
|
||||
L.DomUtil.createButton(
|
||||
'button umap-download',
|
||||
advancedButtons,
|
||||
|
@ -1687,12 +1687,18 @@ U.Map = L.Map.extend({
|
|||
}
|
||||
},
|
||||
|
||||
empty: function () {
|
||||
removeDataLayers: function () {
|
||||
this.eachDataLayerReverse((datalayer) => {
|
||||
datalayer._delete()
|
||||
})
|
||||
},
|
||||
|
||||
emptyDataLayers: function () {
|
||||
this.eachDataLayerReverse((datalayer) => {
|
||||
datalayer.empty()
|
||||
})
|
||||
},
|
||||
|
||||
initLoader: function () {
|
||||
this.loader = new L.Control.Loading()
|
||||
this.loader.onAdd(this)
|
||||
|
|
Loading…
Reference in a new issue