mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-31 12:19:31 +02:00
Remove keybinding coupling from iD.behavior.drag
This commit is contained in:
@@ -24,7 +24,6 @@ iD.behavior.drag = function() {
|
||||
origin = null,
|
||||
selector = '',
|
||||
filter = null,
|
||||
keybinding = d3.keybinding('drag'),
|
||||
event_, target;
|
||||
|
||||
event.of = function(thiz, argumentz) {
|
||||
@@ -137,9 +136,6 @@ iD.behavior.drag = function() {
|
||||
drag.off = function(selection) {
|
||||
selection.on("mousedown.drag" + selector, null)
|
||||
.on("touchstart.drag" + selector, null);
|
||||
keybinding
|
||||
.on('⌘+Z', null)
|
||||
.on('⌃+Z', null);
|
||||
};
|
||||
|
||||
drag.delegate = function(_) {
|
||||
@@ -174,11 +170,5 @@ iD.behavior.drag = function() {
|
||||
return drag;
|
||||
};
|
||||
|
||||
keybinding
|
||||
.on('⌘+Z', drag.cancel)
|
||||
.on('⌃+Z', drag.cancel);
|
||||
|
||||
d3.select(document).call(keybinding);
|
||||
|
||||
return d3.rebind(drag, event, "on");
|
||||
};
|
||||
|
||||
@@ -36,6 +36,8 @@ iD.behavior.DragNode = function(context) {
|
||||
}
|
||||
|
||||
function start(entity) {
|
||||
context.history()
|
||||
.on('undone.drag-node', cancel);
|
||||
|
||||
wasMidpoint = entity.type === 'midpoint';
|
||||
if (wasMidpoint) {
|
||||
@@ -95,12 +97,7 @@ iD.behavior.DragNode = function(context) {
|
||||
}
|
||||
|
||||
function end(entity) {
|
||||
context.surface()
|
||||
.classed('behavior-drag-node', false)
|
||||
.selectAll('.active')
|
||||
.classed('active', false);
|
||||
|
||||
stopNudge();
|
||||
off();
|
||||
|
||||
var d = datum();
|
||||
if (d.type === 'way') {
|
||||
@@ -132,6 +129,23 @@ iD.behavior.DragNode = function(context) {
|
||||
}
|
||||
}
|
||||
|
||||
function off() {
|
||||
context.history()
|
||||
.on('undone.drag_node', null);
|
||||
|
||||
context.surface()
|
||||
.classed('behavior-drag-node', false)
|
||||
.selectAll('.active')
|
||||
.classed('active', false);
|
||||
|
||||
stopNudge();
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
off();
|
||||
behavior.cancel();
|
||||
}
|
||||
|
||||
var behavior = iD.behavior.drag()
|
||||
.delegate("g.node, g.midpoint")
|
||||
.origin(origin)
|
||||
|
||||
Reference in New Issue
Block a user