mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-19 01:23:25 +00:00
Merge pull request #5826 from SilentSpike/reverse-turns
Fix turn:lanes changing when way is reversed
This commit is contained in:
@@ -20,6 +20,7 @@ References:
|
||||
export function actionReverse(wayID, options) {
|
||||
var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
|
||||
var numeric = /^([+\-]?)(?=[\d.])/;
|
||||
var turn_lanes = /^turn:lanes:?/;
|
||||
var keyReplacements = [
|
||||
[/:right$/, ':left'],
|
||||
[/:left$/, ':right'],
|
||||
@@ -63,7 +64,10 @@ export function actionReverse(wayID, options) {
|
||||
function reverseValue(key, value) {
|
||||
if (ignoreKey.test(key)) return value;
|
||||
|
||||
if (key === 'incline' && numeric.test(value)) {
|
||||
// Turn lanes are left/right to key (not way) direction - #5674
|
||||
if (turn_lanes.test(key)) {
|
||||
return value
|
||||
} else if (key === 'incline' && numeric.test(value)) {
|
||||
return value.replace(numeric, function(_, sign) { return sign === '-' ? '' : '-'; });
|
||||
} else if (options && options.reverseOneway && key === 'oneway') {
|
||||
return onewayReplacements[value] || value;
|
||||
|
||||
Reference in New Issue
Block a user