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,27 +1024,27 @@ 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;
geometry.setStyle({ if (Object.keys(geometry._bounds).length === 0) return; // ignore geometries with empty bounds
color: '#FFFFDD', geometry.setStyle({
weight: 3, color: '#FFFFDD',
opacity: 1, weight: 3,
fillOpacity: 0 opacity: 1,
}); 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;
geometry.setStyle({ if (Object.keys(geometry._bounds).length === 0) return; // ignore geometries with empty bounds
weight: 3, geometry.setStyle({
opacity: 0, weight: 3,
fillOpacity: 0 opacity: 0,
}); fillOpacity: 0
geometry.list_elem.removeClass('highlight'); });
} geometry.list_elem.removeClass('highlight');
}, },
// graph events // graph events