don't throw an exception if geometry to highlight does not exist
@@ -309,7 +309,9 @@ editor = {
},
_highlight_geometry: function(id) {
// highlight a geometries layer and itemtable row if they both exist
- editor._highlight_geometries[id].setStyle({
+ var geometry = editor._highlight_geometries[id];
+ if (geometry !== undefined) {
+ geometry.setStyle({
color: '#FFFFDD',
weight: 3,
opacity: 1,
@@ -317,16 +319,20 @@ editor = {
className: 'c3nav-highlight'
});
$('#sidebar').find('[data-list] tr[data-pk='+String(id)+']').addClass('highlight');
+ }
},
_unhighlight_geometry: function(id) {
// unhighlight whatever is highlighted currently
- editor._highlight_geometries[id].setStyle({
+ var geometry = editor._highlight_geometries[id];
+ if (geometry !== undefined) {
+ geometry.setStyle({
weight: 3,
opacity: 0,
fillOpacity: 0,
className: 'c3nav-highlight'
});
$('#sidebar').find('[data-list] tr[data-pk='+String(id)+']').removeClass('highlight');
+ }
},
// edit and create geometries
