Adjust constants, trying to avoid crunched turn indicator on leaf way

This commit is contained in:
Bryan Housel
2018-02-13 17:45:45 -05:00
parent 1612326ffa
commit 0381bad22d
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -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 + ')';
+1 -1
View File
@@ -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);