Add code so tunnel=building_passage doesn't default to layer=-1

(closes #4516)
This commit is contained in:
Bryan Housel
2017-11-09 14:54:00 -05:00
parent bd639f2da0
commit b882ae46bb

View File

@@ -203,10 +203,22 @@ export function uiFieldRadio(field, context) {
}
if (field.type === 'structureRadio') {
if (val === 'no' || (key !== 'bridge' && key !== 'tunnel')) {
// remove layer if it should not be set
if (val === 'no' ||
(key !== 'bridge' && key !== 'tunnel') ||
(key === 'tunnel' && val === 'building_passage')) {
t.layer = undefined;
}
}
// add layer if it should be set
if (t.layer === undefined) {
if (key === 'bridge' && val !== 'no') {
t.layer = '1';
}
if (key === 'tunnel' && val !== 'no' && val !== 'building_passage') {
t.layer = '-1';
}
}
}
dispatch.call('change', this, t, onInput);
}
@@ -243,7 +255,7 @@ export function uiFieldRadio(field, context) {
if (field.type === 'structureRadio') {
if (activeKey === 'bridge') {
t.layer = '1';
} else if (activeKey === 'tunnel') {
} else if (activeKey === 'tunnel' && t.tunnel !== 'building_passage') {
t.layer = '-1';
} else {
t.layer = undefined;