From 01ca07ff0ca4205bd09456aceeeb233cfb34da96 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 25 Jun 2014 16:38:20 -0400 Subject: [PATCH] Compute vertex icons at all zooms (fixes #2249) (before they got created without an icon if they enter() at zoom 16) --- js/id/svg/vertices.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/id/svg/vertices.js b/js/id/svg/vertices.js index 19b14b838..6baa2dc11 100644 --- a/js/id/svg/vertices.js +++ b/js/id/svg/vertices.js @@ -49,18 +49,20 @@ iD.svg.Vertices = function(projection, context) { return iD.Entity.key(entity) + ',' + zoom; }); + var icons = {}, + z; + if (zoom < 17) { - zoom = 0; + z = 0; } else if (zoom < 18) { - zoom = 1; + z = 1; } else { - zoom = 2; + z = 2; } - var icons = {}; function icon(entity) { if (entity.id in icons) return icons[entity.id]; - icons[entity.id] = zoom !== 0 && + icons[entity.id] = entity.hasInterestingTags() && context.presets().match(entity, graph).icon; return icons[entity.id]; @@ -71,7 +73,7 @@ iD.svg.Vertices = function(projection, context) { return function(entity) { var i = icon(entity), c = i ? 0.5 : 0, - r = rads[i ? 3 : zoom]; + r = rads[i ? 3 : z]; this.setAttribute('class', 'node vertex ' + klass + ' ' + entity.id); this.setAttribute('cx', c); this.setAttribute('cy', -c);