mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 07:46:58 +02:00
Use entity ID selectors in more places
This commit is contained in:
@@ -54,8 +54,7 @@ iD.modes.DragNode = function(context) {
|
||||
context.perform(iD.actions.AddMidpoint(midpoint, entity));
|
||||
|
||||
var vertex = context.surface()
|
||||
.selectAll('.vertex')
|
||||
.filter(function(d) { return d.id === entity.id; });
|
||||
.selectAll('.' + entity.id);
|
||||
behavior.target(vertex.node(), entity);
|
||||
|
||||
} else {
|
||||
|
||||
+14
-8
@@ -146,12 +146,19 @@ iD.modes.Select = function(context, selection) {
|
||||
}
|
||||
}
|
||||
|
||||
function selected(entity) {
|
||||
if (!entity) return false;
|
||||
if (selection.indexOf(entity.id) >= 0) return true;
|
||||
return _.any(context.graph().parentRelations(entity), function(parent) {
|
||||
return selection.indexOf(parent.id) >= 0;
|
||||
});
|
||||
function selected() {
|
||||
var s = iD.util.entitySelector(selection);
|
||||
|
||||
selection.forEach(function(id) {
|
||||
var entity = context.entity(id);
|
||||
if (entity.type === 'relation') {
|
||||
entity.members.forEach(function(member) {
|
||||
s += ',.' + member.id
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
d3.select(document)
|
||||
@@ -159,8 +166,7 @@ iD.modes.Select = function(context, selection) {
|
||||
|
||||
function selectElements() {
|
||||
context.surface()
|
||||
.selectAll("*")
|
||||
.filter(selected)
|
||||
.selectAll(selected())
|
||||
.classed('selected', true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user