mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
Merge pull request #1933 from umap-project/fix-change-datalayer
fix: fix path disappearing when changing its datalayer
This commit is contained in:
commit
e4af031ca1
2 changed files with 12 additions and 1 deletions
|
@ -913,10 +913,10 @@ U.DataLayer = L.Evented.extend({
|
||||||
|
|
||||||
removeLayer: function (feature) {
|
removeLayer: function (feature) {
|
||||||
const id = L.stamp(feature)
|
const id = L.stamp(feature)
|
||||||
|
this.layer.removeLayer(feature)
|
||||||
feature.disconnectFromDataLayer(this)
|
feature.disconnectFromDataLayer(this)
|
||||||
this._index.splice(this._index.indexOf(id), 1)
|
this._index.splice(this._index.indexOf(id), 1)
|
||||||
delete this._layers[id]
|
delete this._layers[id]
|
||||||
this.layer.removeLayer(feature)
|
|
||||||
delete this.map.features_index[feature.getSlug()]
|
delete this.map.features_index[feature.getSlug()]
|
||||||
if (this.hasDataLoaded()) this.fire('datachanged')
|
if (this.hasDataLoaded()) this.fire('datachanged')
|
||||||
},
|
},
|
||||||
|
|
|
@ -120,3 +120,14 @@ def test_should_reset_style_on_cancel(live_server, openmap, page, bootstrap):
|
||||||
page.once("dialog", lambda dialog: dialog.accept())
|
page.once("dialog", lambda dialog: dialog.accept())
|
||||||
page.get_by_role("button", name="Cancel edits").click()
|
page.get_by_role("button", name="Cancel edits").click()
|
||||||
expect(page.locator(".leaflet-overlay-pane path[fill='DarkBlue']")).to_have_count(1)
|
expect(page.locator(".leaflet-overlay-pane path[fill='DarkBlue']")).to_have_count(1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_can_change_datalayer(live_server, openmap, page, bootstrap):
|
||||||
|
other = DataLayerFactory(
|
||||||
|
name="Layer 2", map=openmap, settings={"color": "GoldenRod"}
|
||||||
|
)
|
||||||
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
|
expect(page.locator("path[fill='DarkBlue']")).to_have_count(1)
|
||||||
|
page.locator("path").click(modifiers=["Shift"])
|
||||||
|
page.get_by_role("combobox").select_option(other.name)
|
||||||
|
expect(page.locator("path[fill='GoldenRod']")).to_have_count(1)
|
||||||
|
|
Loading…
Reference in a new issue