mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
fix: Do not error when escape during marker creation (#2483)
This commit is contained in:
commit
0cba3ab158
1 changed files with 3 additions and 0 deletions
|
@ -1029,6 +1029,9 @@ U.Editable = L.Editable.extend({
|
||||||
onEscape: function () {
|
onEscape: function () {
|
||||||
this.once('editable:drawing:end', (event) => {
|
this.once('editable:drawing:end', (event) => {
|
||||||
this._umap.tooltip.close()
|
this._umap.tooltip.close()
|
||||||
|
// When hitting Escape before adding a marker,
|
||||||
|
// it tries to edit an unconnected marker.
|
||||||
|
if (event?.layer?.feature?.datalayer === null) return
|
||||||
// Leaflet.Editable will delete the drawn shape if invalid
|
// Leaflet.Editable will delete the drawn shape if invalid
|
||||||
// (eg. line has only one drawn point)
|
// (eg. line has only one drawn point)
|
||||||
// So let's check if the layer has no more shape
|
// So let's check if the layer has no more shape
|
||||||
|
|
Loading…
Reference in a new issue