From cc8291254b503911aa0dd0a817777e03e139ab28 Mon Sep 17 00:00:00 2001 From: Takahiko Tsuchiya Date: Wed, 10 Aug 2016 19:43:15 -0400 Subject: [PATCH] Option (ALT) + drag to copy the block --- src/controller.coffee | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/controller.coffee b/src/controller.coffee index b70540c0..1904918e 100644 --- a/src/controller.coffee +++ b/src/controller.coffee @@ -1787,7 +1787,10 @@ hook 'mouseup', 1, (point, event, state) -> # across parenthesis insertion hadTextToken = @draggingBlock.start.next.type is 'text' - @spliceOut @draggingBlock + # Don't remove the original block if the alt key is pressed + # TODO: For windows, this would be the CTRL key? + if not event.altKey + @spliceOut @draggingBlock @clearHighlightCanvas() @@ -1799,6 +1802,11 @@ hook 'mouseup', 1, (point, event, state) -> # beginning or at its end. # # We will need to log undo operations here too. + + # For ALT-drag to copy the block + if event.altKey + @draggingBlock = @draggingBlock.clone() + switch @lastHighlight.type when 'indent', 'socket' @spliceIn @draggingBlock, @lastHighlight.start