what if the editor didn't crash?
This commit is contained in:
parent
927b388ca8
commit
7ba2f60ce3
1 changed files with 24 additions and 9 deletions
|
@ -1072,13 +1072,21 @@ editor = {
|
||||||
list_elem = $('#sidebar').find('[data-list] tr[data-pk=' + String(highlight_id) + ']');
|
list_elem = $('#sidebar').find('[data-list] tr[data-pk=' + String(highlight_id) + ']');
|
||||||
}
|
}
|
||||||
if (list_elem.length === 0) return;
|
if (list_elem.length === 0) return;
|
||||||
var option = editor.accessRestrictionSelect.find('[value='+String(feature.properties.access_restriction)+']');
|
var hasOption, optionSelected;
|
||||||
|
if (editor.accessRestrictionSelect) {
|
||||||
|
var option = editor.accessRestrictionSelect.find('[value=' + String(feature.properties.access_restriction) + ']');
|
||||||
|
hasOption = !!option.length;
|
||||||
|
optionSelected = option.is(':selected');
|
||||||
|
} else {
|
||||||
|
hasOption = false;
|
||||||
|
optionSelected = false;
|
||||||
|
}
|
||||||
var highlight_layer = L.geoJSON(layer.feature, {
|
var highlight_layer = L.geoJSON(layer.feature, {
|
||||||
style: function () {
|
style: function () {
|
||||||
return {
|
return {
|
||||||
color: option.length ? '#FF0000' : '#FFFFDD',
|
color: hasOption ? '#FF0000' : '#FFFFDD',
|
||||||
weight: (option.length && !option.is(':selected')) ? 1 : 3,
|
weight: (hasOption && !optionSelected) ? 1 : 3,
|
||||||
opacity: option.length ? (option.is(':selected') ? 1 : 0.3) : 0,
|
opacity: hasOption ? (optionSelected ? 1 : 0.3) : 0,
|
||||||
fillOpacity: 0,
|
fillOpacity: 0,
|
||||||
className: 'c3nav-highlight'
|
className: 'c3nav-highlight'
|
||||||
};
|
};
|
||||||
|
@ -1232,7 +1240,6 @@ editor = {
|
||||||
if (!geometries) return;
|
if (!geometries) return;
|
||||||
var option;
|
var option;
|
||||||
for (geometry of geometries) {
|
for (geometry of geometries) {
|
||||||
option = editor.accessRestrictionSelect.find('[value='+String(geometry.highlightID)+']')
|
|
||||||
geometry.setStyle({
|
geometry.setStyle({
|
||||||
color: '#FFFFDD',
|
color: '#FFFFDD',
|
||||||
weight: 3,
|
weight: 3,
|
||||||
|
@ -1248,11 +1255,19 @@ editor = {
|
||||||
if (!geometries) return;
|
if (!geometries) return;
|
||||||
var option;
|
var option;
|
||||||
for (geometry of geometries) {
|
for (geometry of geometries) {
|
||||||
option = editor.accessRestrictionSelect.find('[value='+String(geometry.highlightID)+']')
|
var hasOption, optionSelected;
|
||||||
|
if (editor.accessRestrictionSelect) {
|
||||||
|
var option = editor.accessRestrictionSelect.find('[value=' + String(feature.properties.access_restriction) + ']');
|
||||||
|
hasOption = !!option.length;
|
||||||
|
optionSelected = option.is(':selected');
|
||||||
|
} else {
|
||||||
|
hasOption = false;
|
||||||
|
optionSelected = false;
|
||||||
|
}
|
||||||
geometry.setStyle({
|
geometry.setStyle({
|
||||||
color: option.length ? '#FF0000' : '#FFFFDD',
|
color: hasOption ? '#FF0000' : '#FFFFDD',
|
||||||
weight: (option.length && !option.is(':selected')) ? 1 : 3,
|
weight: (hasOption && !optionSelected) ? 1 : 3,
|
||||||
opacity: option.length ? (option.is(':selected') ? 1 : 0.3) : 0,
|
opacity: hasOption ? (optionSelected ? 1 : 0.3) : 0,
|
||||||
fillOpacity: 0,
|
fillOpacity: 0,
|
||||||
});
|
});
|
||||||
geometry.list_elem.removeClass('highlight');
|
geometry.list_elem.removeClass('highlight');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue