mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Avoid sneaky subselection data inheritance
This commit is contained in:
+1
-1
@@ -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']);
|
||||
|
||||
|
||||
+3
-3
@@ -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);
|
||||
|
||||
+1
-1
@@ -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));
|
||||
|
||||
|
||||
@@ -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; });
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+9
-19
@@ -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;
|
||||
|
||||
@@ -43,7 +43,7 @@ iD.ui.preset.restrictions = function(field, context) {
|
||||
|
||||
enter
|
||||
.call(drawLayers)
|
||||
.select('.surface')
|
||||
.selectAll('.surface')
|
||||
.call(iD.behavior.Hover(context));
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user