mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Make handles connected to more than one way cyan. Fixes #205
This commit is contained in:
@@ -32,6 +32,10 @@ circle.handle {
|
||||
stroke-opacity: 1;
|
||||
}
|
||||
|
||||
circle.handle.two-parents {
|
||||
fill:#aff;
|
||||
}
|
||||
|
||||
circle.handle.hover {
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,17 @@ iD.Graph.prototype = {
|
||||
return this.entities[id];
|
||||
},
|
||||
|
||||
parentStructure: function(ways) {
|
||||
var nodes = {};
|
||||
ways.forEach(function(w) {
|
||||
_.uniq(w.nodes).forEach(function(n) {
|
||||
if (typeof nodes[n.id] === 'undefined') nodes[n.id] = 0;
|
||||
nodes[n.id]++;
|
||||
});
|
||||
});
|
||||
return nodes;
|
||||
},
|
||||
|
||||
parentWays: function(id) {
|
||||
// This is slow and a bad hack.
|
||||
return _.filter(this.entities, function(e) {
|
||||
|
||||
@@ -96,6 +96,7 @@ iD.Map = function() {
|
||||
filter = function(d) { return d.accuracy ? d.way in only : d.id in only; };
|
||||
}
|
||||
|
||||
|
||||
if (all.length > 10000) return editOff();
|
||||
else editOn();
|
||||
|
||||
@@ -112,10 +113,11 @@ iD.Map = function() {
|
||||
waynodes.push(a);
|
||||
}
|
||||
}
|
||||
var parentStructure = graph.parentStructure(ways);
|
||||
var wayAccuracyHandles = ways.reduce(function(mem, w) {
|
||||
return mem.concat(accuracyHandles(w));
|
||||
}, []);
|
||||
drawHandles(waynodes, filter);
|
||||
drawHandles(waynodes, parentStructure, filter);
|
||||
drawAccuracyHandles(wayAccuracyHandles, filter);
|
||||
drawCasings(lines, filter);
|
||||
drawFills(areas, filter);
|
||||
@@ -138,7 +140,7 @@ iD.Map = function() {
|
||||
return handles;
|
||||
}
|
||||
|
||||
function drawHandles(waynodes, filter) {
|
||||
function drawHandles(waynodes, parentStructure, filter) {
|
||||
var handles = g.hit.selectAll('circle.handle')
|
||||
.filter(filter)
|
||||
.data(waynodes, key);
|
||||
@@ -160,6 +162,9 @@ iD.Map = function() {
|
||||
return d.id === hover ? 8: 4;
|
||||
})
|
||||
.classed('active', classActive)
|
||||
.classed('two-parents', function(d) {
|
||||
return parentStructure[d.id] > 1;
|
||||
})
|
||||
.classed('hover', classHover);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user