Permalink
Browse files

shadows for multipolygons

  • Loading branch information...
1 parent cebf5dc commit d7cc24b935f210b88527b69c566c2bbe91c33aa2 @ansis ansis committed Apr 5, 2013
Showing with 13 additions and 4 deletions.
  1. +12 −3 js/id/behavior/hover.js
  2. +1 −1 js/id/modes/select.js
View
@@ -23,18 +23,27 @@ iD.behavior.Hover = function() {
}
}
- var hover = function(_) {
- selection = _;
+ var hover = function(__) {
+ selection = __;
if (!altDisables || !d3.event || !d3.event.altKey) {
selection.classed('behavior-hover', true);
}
function mouseover() {
var datum = d3.event.target.__data__;
+
if (datum) {
+ var hovered = [datum.id];
+
+ if (datum.type === 'relation') {
+ hovered = hovered.concat(_.pluck(datum.members, 'id'));
+ }
+
+ hovered = d3.set(hovered);
+
selection.selectAll('*')
- .filter(function(d) { return d === datum; })
+ .filter(function(d) { return d && hovered.has(d.id); })
.classed('hover', true);
}
}
View
@@ -129,7 +129,7 @@ iD.modes.Select = function(context, selection, initial) {
function selected(entity) {
if (!entity) return false;
if (selection.indexOf(entity.id) >= 0) return true;
- return d3.select(this).classed('stroke') &&
+ return d3.select(this) &&
@jfirebaugh

jfirebaugh Apr 5, 2013

Member

d3.select(this) is always going to be truthy, so you can drop it entirely.

_.any(context.graph().parentRelations(entity), function(parent) {
return selection.indexOf(parent.id) >= 0;
});

1 comment on commit d7cc24b

Collaborator

ansis commented on d7cc24b Apr 5, 2013

Hah, not sure what I was thinking.

Please sign in to comment.