mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 20:02:36 +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
|
// we cannot rely on this because of the y is overriden by Leaflet
|
||||||
// See https://github.com/Leaflet/Leaflet/pull/9201
|
// See https://github.com/Leaflet/Leaflet/pull/9201
|
||||||
// And let's remove this -y when this PR is merged and released.
|
// 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: [],
|
licences: [],
|
||||||
licence: '',
|
licence: '',
|
||||||
enableMarkerDraw: true,
|
enableMarkerDraw: true,
|
||||||
|
@ -1505,8 +1505,15 @@ U.Map = L.Map.extend({
|
||||||
L.DomUtil.createButton(
|
L.DomUtil.createButton(
|
||||||
'button umap-empty',
|
'button umap-empty',
|
||||||
advancedButtons,
|
advancedButtons,
|
||||||
L._('Empty'),
|
L._('Clear data'),
|
||||||
this.empty,
|
this.emptyDataLayers,
|
||||||
|
this
|
||||||
|
)
|
||||||
|
L.DomUtil.createButton(
|
||||||
|
'button umap-empty',
|
||||||
|
advancedButtons,
|
||||||
|
L._('Remove layers'),
|
||||||
|
this.removeDataLayers,
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1517,13 +1524,6 @@ U.Map = L.Map.extend({
|
||||||
this.clone,
|
this.clone,
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
L.DomUtil.createButton(
|
|
||||||
'button umap-empty',
|
|
||||||
advancedButtons,
|
|
||||||
L._('Delete all layers'),
|
|
||||||
this.empty,
|
|
||||||
this
|
|
||||||
)
|
|
||||||
L.DomUtil.createButton(
|
L.DomUtil.createButton(
|
||||||
'button umap-download',
|
'button umap-download',
|
||||||
advancedButtons,
|
advancedButtons,
|
||||||
|
@ -1687,12 +1687,18 @@ U.Map = L.Map.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
empty: function () {
|
removeDataLayers: function () {
|
||||||
this.eachDataLayerReverse((datalayer) => {
|
this.eachDataLayerReverse((datalayer) => {
|
||||||
datalayer._delete()
|
datalayer._delete()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emptyDataLayers: function () {
|
||||||
|
this.eachDataLayerReverse((datalayer) => {
|
||||||
|
datalayer.empty()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
initLoader: function () {
|
initLoader: function () {
|
||||||
this.loader = new L.Control.Loading()
|
this.loader = new L.Control.Loading()
|
||||||
this.loader.onAdd(this)
|
this.loader.onAdd(this)
|
||||||
|
|
Loading…
Reference in a new issue