don't try to highlight empty spaces in editor

This commit is contained in:
Gwendolyn 2023-12-03 18:49:29 +01:00
parent ef223ee09c
commit e31b318b47

View file

@ -1024,7 +1024,8 @@ editor = {
_highlight_geometry: function(id) { _highlight_geometry: function(id) {
// highlight a geometries layer and itemtable row if they both exist // highlight a geometries layer and itemtable row if they both exist
var geometry = editor._highlight_geometries[id]; var geometry = editor._highlight_geometries[id];
if (geometry !== undefined) { if (!geometry) return;
if (Object.keys(geometry._bounds).length === 0) return; // ignore geometries with empty bounds
geometry.setStyle({ geometry.setStyle({
color: '#FFFFDD', color: '#FFFFDD',
weight: 3, weight: 3,
@ -1032,19 +1033,18 @@ editor = {
fillOpacity: 0 fillOpacity: 0
}); });
geometry.list_elem.addClass('highlight'); geometry.list_elem.addClass('highlight');
}
}, },
_unhighlight_geometry: function(id) { _unhighlight_geometry: function(id) {
// unhighlight whatever is highlighted currently // unhighlight whatever is highlighted currently
var geometry = editor._highlight_geometries[id]; var geometry = editor._highlight_geometries[id];
if (geometry !== undefined) { if (!geometry) return;
if (Object.keys(geometry._bounds).length === 0) return; // ignore geometries with empty bounds
geometry.setStyle({ geometry.setStyle({
weight: 3, weight: 3,
opacity: 0, opacity: 0,
fillOpacity: 0 fillOpacity: 0
}); });
geometry.list_elem.removeClass('highlight'); geometry.list_elem.removeClass('highlight');
}
}, },
// graph events // graph events