don't throw an exception if geometry to highlight does not exist

This commit is contained in:
Laura Klünder 2017-05-26 16:31:33 +02:00
parent 1e30d615e6
commit 0931516b16

View file

@ -309,24 +309,30 @@ 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
editor._highlight_geometries[id].setStyle({ var geometry = editor._highlight_geometries[id];
color: '#FFFFDD', if (geometry !== undefined) {
weight: 3, geometry.setStyle({
opacity: 1, color: '#FFFFDD',
fillOpacity: 0, weight: 3,
className: 'c3nav-highlight' opacity: 1,
}); fillOpacity: 0,
$('#sidebar').find('[data-list] tr[data-pk='+String(id)+']').addClass('highlight'); className: 'c3nav-highlight'
});
$('#sidebar').find('[data-list] tr[data-pk='+String(id)+']').addClass('highlight');
}
}, },
_unhighlight_geometry: function(id) { _unhighlight_geometry: function(id) {
// unhighlight whatever is highlighted currently // unhighlight whatever is highlighted currently
editor._highlight_geometries[id].setStyle({ var geometry = editor._highlight_geometries[id];
weight: 3, if (geometry !== undefined) {
opacity: 0, geometry.setStyle({
fillOpacity: 0, weight: 3,
className: 'c3nav-highlight' opacity: 0,
}); fillOpacity: 0,
$('#sidebar').find('[data-list] tr[data-pk='+String(id)+']').removeClass('highlight'); className: 'c3nav-highlight'
});
$('#sidebar').find('[data-list] tr[data-pk='+String(id)+']').removeClass('highlight');
}
}, },
// edit and create geometries // edit and create geometries