diff --git a/js/id/svg/areas.js b/js/id/svg/areas.js index ebc77101f..e4121e33d 100644 --- a/js/id/svg/areas.js +++ b/js/id/svg/areas.js @@ -82,7 +82,7 @@ iD.svg.Areas = function(projection) { .remove(); var areagroup = surface - .select('.layer-areas') + .selectAll('.layer-areas') .selectAll('g.areagroup') .data(['fill', 'shadow', 'stroke']); diff --git a/js/id/svg/labels.js b/js/id/svg/labels.js index c3315effb..d4639a71b 100644 --- a/js/id/svg/labels.js +++ b/js/id/svg/labels.js @@ -248,7 +248,7 @@ iD.svg.Labels = function(projection, context) { rectangles = {}; function drawLabels(surface, graph, entities, filter, dimensions, fullRedraw) { - var hidePoints = !surface.select('.node.point').node(); + var hidePoints = !surface.selectAll('.node.point').node(); var labelable = [], i, k, entity; for (i = 0; i < label_stack.length; i++) labelable.push([]); @@ -407,8 +407,8 @@ iD.svg.Labels = function(projection, context) { return v; } - var label = surface.select('.layer-label'), - halo = surface.select('.layer-halo'); + var label = surface.selectAll('.layer-label'), + halo = surface.selectAll('.layer-halo'); // points drawPointLabels(label, labelled.point, filter, 'pointlabel', positions.point); diff --git a/js/id/svg/lines.js b/js/id/svg/lines.js index d62d0c74e..216612416 100644 --- a/js/id/svg/lines.js +++ b/js/id/svg/lines.js @@ -50,7 +50,7 @@ iD.svg.Lines = function(projection) { }); var layergroup = surface - .select('.layer-lines') + .selectAll('.layer-lines') .selectAll('g.layergroup') .data(d3.range(-10, 11)); diff --git a/js/id/svg/midpoints.js b/js/id/svg/midpoints.js index 86a6a12a1..3daf82e0e 100644 --- a/js/id/svg/midpoints.js +++ b/js/id/svg/midpoints.js @@ -67,7 +67,7 @@ iD.svg.Midpoints = function(projection, context) { return false; } - var groups = surface.select('.layer-hit').selectAll('g.midpoint') + var groups = surface.selectAll('.layer-hit').selectAll('g.midpoint') .filter(midpointFilter) .data(_.values(midpoints), function(d) { return d.id; }); diff --git a/js/id/svg/points.js b/js/id/svg/points.js index d6deb8707..8bcf86fd9 100644 --- a/js/id/svg/points.js +++ b/js/id/svg/points.js @@ -18,7 +18,7 @@ iD.svg.Points = function(projection, context) { points.sort(sortY); - var groups = surface.select('.layer-hit').selectAll('g.point') + var groups = surface.selectAll('.layer-hit').selectAll('g.point') .filter(filter) .data(points, iD.Entity.key); diff --git a/js/id/svg/turns.js b/js/id/svg/turns.js index 9cbfe80c9..c5007a745 100644 --- a/js/id/svg/turns.js +++ b/js/id/svg/turns.js @@ -13,7 +13,7 @@ iD.svg.Turns = function(projection) { (!turn.indirect_restriction && /^only_/.test(restriction) ? 'only' : 'no') + u; } - var groups = surface.select('.layer-hit').selectAll('g.turn') + var groups = surface.selectAll('.layer-hit').selectAll('g.turn') .data(turns, key); // Enter diff --git a/js/id/svg/vertices.js b/js/id/svg/vertices.js index 73b971880..c838c7daa 100644 --- a/js/id/svg/vertices.js +++ b/js/id/svg/vertices.js @@ -48,19 +48,10 @@ iD.svg.Vertices = function(projection, context) { function draw(selection, vertices, klass, graph, zoom) { var icons = {}, - z; + z = (zoom < 17 ? 0 : zoom < 18 ? 1 : 2); - if (zoom < 17) { - z = 0; - } else if (zoom < 18) { - z = 1; - } else { - z = 2; - } - - var groups = selection.data(vertices, function(entity) { - return iD.Entity.key(entity); - }); + var groups = selection + .data(vertices, iD.Entity.key); function icon(entity) { if (entity.id in icons) return icons[entity.id]; @@ -162,7 +153,7 @@ iD.svg.Vertices = function(projection, context) { } } - surface.select('.layer-hit').selectAll('g.vertex.vertex-persistent') + surface.selectAll('.layer-hit').selectAll('g.vertex.vertex-persistent') .filter(filter) .call(draw, vertices, 'vertex-persistent', graph, zoom); @@ -172,15 +163,14 @@ iD.svg.Vertices = function(projection, context) { function drawHover(surface, graph, extent, zoom) { var hovered = hover ? siblingAndChildVertices([hover.id], graph, extent) : {}; - surface.select('.layer-hit').selectAll('g.vertex.vertex-hover') + surface.selectAll('.layer-hit').selectAll('g.vertex.vertex-hover') .call(draw, d3.values(hovered), 'vertex-hover', graph, zoom); } - drawVertices.drawHover = function(surface, graph, _, extent, zoom) { - if (hover !== _) { - hover = _; - drawHover(surface, graph, extent, zoom); - } + drawVertices.drawHover = function(surface, graph, target, extent, zoom) { + if (target === hover) return; + hover = target; + drawHover(surface, graph, extent, zoom); }; return drawVertices; diff --git a/js/id/ui/preset/restrictions.js b/js/id/ui/preset/restrictions.js index 2c7912074..f2ef9cfac 100644 --- a/js/id/ui/preset/restrictions.js +++ b/js/id/ui/preset/restrictions.js @@ -43,7 +43,7 @@ iD.ui.preset.restrictions = function(field, context) { enter .call(drawLayers) - .select('.surface') + .selectAll('.surface') .call(iD.behavior.Hover(context));