From 0381bad22d987b27bb6b8315b6dac9560a052c76 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 13 Feb 2018 17:45:45 -0500 Subject: [PATCH] Adjust constants, trying to avoid crunched turn indicator on leaf way --- modules/svg/turns.js | 8 ++++++-- modules/ui/fields/restrictions.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/svg/turns.js b/modules/svg/turns.js index 1746a8639..257d16a94 100644 --- a/modules/svg/turns.js +++ b/modules/svg/turns.js @@ -63,13 +63,17 @@ export function svgTurns(projection) { groups .attr('transform', function (turn) { + var pxOffset = 50; + var way = graph.entity(turn.to.way); var t = graph.entity(turn.to.node); var v = graph.entity(turn.to.vertex); var a = geoAngle(v, t, projection); var p = projection(v.loc); var q = projection(t.loc); - var mid = geoVecLength(p, q) / 2; - var r = turn.u ? 0 : Math.min(mid, 50); + var mid = geoVecLength(p, q) / 2; // midpoint of destination way + var r = turn.u ? 0 + : !way.__via ? pxOffset // leaf way: put marker at pxOffset + : Math.min(mid, pxOffset); // via way: prefer pxOffset, fallback to midpoint return 'translate(' + (r * Math.cos(a) + p[0]) + ',' + (r * Math.sin(a) + p[1]) + ') ' + 'rotate(' + a * 180 / Math.PI + ')'; diff --git a/modules/ui/fields/restrictions.js b/modules/ui/fields/restrictions.js index acb2c5295..2e6905bcc 100644 --- a/modules/ui/fields/restrictions.js +++ b/modules/ui/fields/restrictions.js @@ -254,7 +254,7 @@ export function uiFieldRestrictions(field, context) { // If this is a large intersection, adjust zoom to fit extent if (_intersection.vertices.length > 1) { - var padding = 150; // in z22 pixels + var padding = 160; // in z22 pixels var tl = projection([extent[0][0], extent[1][1]]); var br = projection([extent[1][0], extent[0][1]]); var hFactor = (br[0] - tl[0]) / (d[0] - padding);