Add shadow on area strokes (fixes #674)

This commit is contained in:
John Firebaugh
2013-03-07 10:32:59 -08:00
parent 457922856e
commit a6ce12efb6
3 changed files with 24 additions and 23 deletions

View File

@@ -822,7 +822,8 @@ text.point {
.mode-draw-area .behavior-hover .way,
.mode-add-line .behavior-hover .way,
.mode-add-area .behavior-hover .way,
.behavior-drag-node.behavior-hover .way {
.behavior-drag-node.behavior-hover .way.stroke,
.behavior-drag-node.behavior-hover .way.shadow {
cursor: crosshair;
cursor: url(../img/cursor-draw-connect-line.png) 9 9, crosshair;
}

View File

@@ -72,9 +72,16 @@ iD.behavior.DragNode = function(context) {
function datum() {
if (d3.event.sourceEvent.altKey) {
return {};
} else {
return d3.event.sourceEvent.target.__data__ || {};
}
var datum = d3.event.sourceEvent.target.__data__,
target = d3.select(d3.event.sourceEvent.target);
if (datum && !target.classed('fill')) {
return datum;
}
return {};
}
function move(entity) {
@@ -91,15 +98,12 @@ iD.behavior.DragNode = function(context) {
if (d.type === 'node' && d.id !== entity.id) {
loc = d.loc;
} else if (d.type === 'way') {
var point = d3.mouse(context.surface().node()),
index = iD.geo.chooseIndex(d, point, context);
if (iD.geo.dist(point, context.projection(index.loc)) < 10) {
loc = index.loc;
}
loc = iD.geo.chooseIndex(d, d3.mouse(context.surface().node()), context).loc;
}
context.replace(iD.actions.MoveNode(entity.id, loc),
t('operations.move.annotation.' + entity.geometry(context.graph())));
context.replace(
iD.actions.MoveNode(entity.id, loc),
t('operations.move.annotation.' + entity.geometry(context.graph())));
}
function end(entity) {
@@ -108,18 +112,12 @@ iD.behavior.DragNode = function(context) {
var d = datum();
if (d.type === 'way') {
var point = d3.mouse(context.surface().node()),
choice = iD.geo.chooseIndex(d, point, context);
if (iD.geo.dist(point, context.projection(choice.loc)) < 10) {
context.replace(
iD.actions.MoveNode(entity.id, choice.loc),
iD.actions.AddVertex(d.id, entity.id, choice.index),
connectAnnotation(d));
return;
}
}
if (d.type === 'node' && d.id !== entity.id) {
var choice = iD.geo.chooseIndex(d, d3.mouse(context.surface().node()), context);
context.replace(
iD.actions.MoveNode(entity.id, choice.loc),
iD.actions.AddVertex(d.id, entity.id, choice.index),
connectAnnotation(d));
} else if (d.type === 'node' && d.id !== entity.id) {
context.replace(
iD.actions.Connect([entity.id, d.id]),
connectAnnotation(d));

View File

@@ -83,9 +83,11 @@ iD.svg.Areas = function(projection) {
return area.type === 'way';
});
var fill = surface.select('.layer-fill'),
var shadow = surface.select('.layer-shadow'),
fill = surface.select('.layer-fill'),
stroke = surface.select('.layer-stroke');
drawPaths(shadow, strokes, filter, 'shadow');
drawPaths(fill, areas, filter, 'fill', true);
drawPaths(stroke, strokes, filter, 'stroke');
};