diff --git a/modules/behavior/drag.js b/modules/behavior/drag.js index dc79f51f2..e02cf214f 100644 --- a/modules/behavior/drag.js +++ b/modules/behavior/drag.js @@ -60,7 +60,7 @@ export function behaviorDrag() { }; - function mousedown() { + function dragstart() { target = this; event_ = eventOf(target, arguments); @@ -84,8 +84,9 @@ export function behaviorDrag() { if (touchId === null) d3.event.stopPropagation(); + function point() { - var p = target.parentNode || surface; + var p = surface || target.parentNode; return touchId !== null ? d3.touches(p).filter(function(p) { return p.identifier === touchId; })[0] : d3.mouse(p); @@ -143,7 +144,7 @@ export function behaviorDrag() { function drag(selection) { var matchesSelector = utilPrefixDOMProperty('matchesSelector'), - delegate = mousedown; + delegate = dragstart; if (selector) { delegate = function() { @@ -152,7 +153,7 @@ export function behaviorDrag() { for (; target && target !== root; target = target.parentNode) { if (target[matchesSelector](selector) && (!filter || filter(target.__data__))) { - return mousedown.call(target, target.__data__); + return dragstart.call(target, target.__data__); } } }; diff --git a/modules/modes/drag_node.js b/modules/modes/drag_node.js index 0c3078051..46964ae5c 100644 --- a/modules/modes/drag_node.js +++ b/modules/modes/drag_node.js @@ -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)