Use #map.node() for drag surface instead of svg #surface

This is because #surface can be transformed during a partial redraw
and d3.mouse() returns transformed point, not the real screen point.
https://github.com/d3/d3-selection/blob/a2cf4f32ec2a88196c9f992e34ec23aec589f797/src/point.js#L4-L9
This commit is contained in:
Bryan Housel
2017-01-29 17:11:55 -05:00
parent 31dcabc8f8
commit f93e57b97d
2 changed files with 6 additions and 10 deletions
+1 -6
View File
@@ -152,11 +152,6 @@ export function modeDragNode(context) {
loc = context.projection.invert(currMouse),
d = datum();
console.log('event.point = ' + (d3.event && d3.event.point) +
', currMouse = ' + currMouse +
', context.mouse = ' + context.mouse()
);
if (d.type === 'node' && d.id !== entity.id) {
loc = d.loc;
} else if (d.type === 'way' && !d3.select(d3.event.sourceEvent.target).classed('fill')) {
@@ -241,7 +236,7 @@ console.log('event.point = ' + (d3.event && d3.event.point) +
var behavior = behaviorDrag()
.delegate('g.node, g.point, g.midpoint')
.surface(context.surface().node())
.surface(d3.select('#map').node())
.origin(origin)
.on('start', start)
.on('move', move)