mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
parent
bdcbd09064
commit
cd4b2189ee
2 changed files with 33 additions and 1 deletions
|
@ -231,7 +231,7 @@ U.DeleteShapeAction = U.BaseFeatureAction.extend({
|
|||
},
|
||||
|
||||
onClick: function (e) {
|
||||
this.feature.enableEdit().deleteShapeAt(e.latlng)
|
||||
this.feature.ui.enableEdit().deleteShapeAt(e.latlng)
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
@ -319,3 +319,35 @@ def test_can_transform_polyline_to_polygon(live_server, page, tilelayer, setting
|
|||
data = save_and_get_json(page)
|
||||
assert len(data["features"]) == 1
|
||||
assert data["features"][0]["geometry"]["type"] == "Polygon"
|
||||
|
||||
|
||||
def test_can_delete_shape_using_toolbar(live_server, page, tilelayer, settings):
|
||||
settings.UMAP_ALLOW_ANONYMOUS = True
|
||||
page.goto(f"{live_server.url}/en/map/new/")
|
||||
page.get_by_title("Draw a polyline").click()
|
||||
map = page.locator("#map")
|
||||
map.click(position={"x": 200, "y": 100})
|
||||
map.click(position={"x": 100, "y": 100})
|
||||
map.click(position={"x": 100, "y": 200})
|
||||
map.click(position={"x": 100, "y": 200})
|
||||
|
||||
# Now split the line
|
||||
map.click(position={"x": 100, "y": 100})
|
||||
page.get_by_role("link", name="Split line").click()
|
||||
|
||||
# Delete part of it
|
||||
map.click(position={"x": 125, "y": 100})
|
||||
page.get_by_role("link", name="Delete this shape").click()
|
||||
data = save_and_get_json(page)
|
||||
assert len(data["features"]) == 1
|
||||
assert data["features"][0]["geometry"]["type"] == "LineString"
|
||||
assert data["features"][0]["geometry"]["coordinates"] == [
|
||||
[
|
||||
-9.865723,
|
||||
54.457267,
|
||||
],
|
||||
[
|
||||
-9.865723,
|
||||
53.159947,
|
||||
],
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue