Merge branch 'master' of github.com:systemed/iD

This commit is contained in:
Tom MacWright
2013-01-28 16:19:00 -05:00
3 changed files with 22 additions and 3 deletions

View File

@@ -23,7 +23,8 @@ iD.behavior.drag = function () {
var event = d3.dispatch("start", "move", "end"),
origin = null,
selector = '',
filter = null;
filter = null,
keybinding = d3.keybinding('drag');
event.of = function(thiz, argumentz) {
return function(e1) {
@@ -135,6 +136,9 @@ 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(_) {
@@ -155,5 +159,18 @@ iD.behavior.drag = function () {
return drag;
};
drag.cancel = function() {
d3.select(window)
.on("mousemove.drag", null)
.on("mouseup.drag", null);
return drag;
};
keybinding
.on('⌘+Z', drag.cancel)
.on('⌃+Z', drag.cancel);
d3.select(document).call(keybinding);
return d3.rebind(drag, event, "on");
};

View File

@@ -14,7 +14,8 @@ iD.behavior.DragNode = function(mode) {
.on('move', function(entity) {
d3.event.sourceEvent.stopPropagation();
history.replace(
iD.actions.MoveNode(entity.id, projection.invert(d3.event.point)));
iD.actions.MoveNode(entity.id, projection.invert(d3.event.point)),
'moved a node');
})
.on('end', function() {
history.replace(

View File

@@ -17,7 +17,8 @@ iD.behavior.DragWay = function(mode) {
.on('move', function(entity) {
d3.event.sourceEvent.stopPropagation();
history.replace(
iD.actions.MoveWay(entity.id, d3.event.delta, projection));
iD.actions.MoveWay(entity.id, d3.event.delta, projection),
'moved a way');
})
.on('end', function() {
history.replace(