Fix nopefilters by testing the original id for the filter

This commit is contained in:
Bryan Housel
2017-12-22 00:26:39 -05:00
parent 2be62fffe5
commit 7851c49e80
4 changed files with 16 additions and 7 deletions
+1
View File
@@ -76,6 +76,7 @@ export function svgAreas(projection, context) {
// NOPE
var nopes = selection.selectAll('.area.target-nope')
.filter(function(d) { return filter({ id: d.properties.originalID }); })
.data(data.nopes, function key(d) { return d.id; });
// exit
+3
View File
@@ -245,6 +245,9 @@ export function svgSegmentWay(way, graph, activeID) {
features.active.push({
'type': 'Feature',
'id': way.id + '-nope', // break the ids on purpose
'properties': {
'originalID': way.id
},
'geometry': {
'type': 'MultiLineString',
'coordinates': coordGroups.active
+9 -3
View File
@@ -72,6 +72,7 @@ export function svgLines(projection, context) {
// NOPE
var nopes = selection.selectAll('.line.target-nope')
.filter(function(d) { return filter({ id: d.properties.originalID }); })
.data(data.nopes, function key(d) { return d.id; });
// exit
@@ -101,6 +102,11 @@ export function svgLines(projection, context) {
function drawLineGroup(selection, klass, isSelected) {
// Note: Don't add `.selected` class in draw modes
var mode = context.mode();
var isDrawing = mode && /^draw/.test(mode.id);
var selectedClass = (!isDrawing && isSelected) ? 'selected ' : '';
var lines = selection
.selectAll('path')
.filter(filter)
@@ -109,13 +115,13 @@ export function svgLines(projection, context) {
lines.exit()
.remove();
// Optimization: call simple TagClasses only on enter selection. This
// Optimization: Call expensive TagClasses only on enter selection. This
// works because osmEntity.key is defined to include the entity v attribute.
lines.enter()
.append('path')
.attr('class', function(d) {
return 'way line ' + klass + ' ' + d.id + (isSelected ? ' selected' : '') +
(oldMultiPolygonOuters[d.id] ? ' old-multipolygon' : '');
var oldMPClass = oldMultiPolygonOuters[d.id] ? 'old-multipolygon ' : '';
return 'way line ' + klass + ' ' + selectedClass + oldMPClass + d.id;
})
.call(svgTagClasses())
.merge(lines)
+3 -4
View File
@@ -196,6 +196,7 @@ export function svgVertices(projection, context) {
} else {
data.nopes.push({
id: node.id + '-nope', // not a real osmNode, break the id on purpose
originalID: node.id,
loc: node.loc
});
}
@@ -222,6 +223,7 @@ export function svgVertices(projection, context) {
// NOPE
var nopes = selection.selectAll('.vertex.target-nope')
.filter(function(d) { return filter({ id: d.originalID }); })
.data(data.nopes, function key(d) { return d.id; });
// exit
@@ -351,11 +353,8 @@ export function svgVertices(projection, context) {
.call(draw, graph, currentVisible(all), sets, filterRendered);
// Draw touch targets..
var filterTargets = function(d) {
return isMoving ? true : filterRendered(d);
};
selection.selectAll('.layer-points .layer-points-targets')
.call(drawTargets, graph, currentVisible(all), filterTargets);
.call(drawTargets, graph, currentVisible(all), filterRendered);
function currentVisible(which) {