Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option (ALT) + drag to copy the block #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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
Expand Down