Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix turn:lanes changing when way is reversed #5826

Merged
merged 1 commit into from
Jan 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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