Skip to content

Commit

Permalink
Merge pull request #5826 from SilentSpike/reverse-turns
Browse files Browse the repository at this point in the history
Fix turn:lanes changing when way is reversed
  • Loading branch information
bhousel authored Jan 29, 2019
2 parents b1de70c + 20d629a commit d3c0d1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/actions/reverse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d3c0d1a

Please sign in to comment.