From c489ca1fc95e68eaeb74bda11632f59687a89312 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Sat, 7 Jan 2017 23:56:09 -0800 Subject: [PATCH 1/2] Option for moving one block from stack. See thread in support group before merging. --- core/block_svg.js | 13 ++++++++++--- core/constants.js | 8 +++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/core/block_svg.js b/core/block_svg.js index 4bc170d53..95120a284 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -950,9 +950,16 @@ Blockly.BlockSvg.prototype.onMouseMove_ = function(e) { Blockly.dragMode_ = Blockly.DRAG_FREE; Blockly.longStop_(); this.workspace.setResizesEnabled(false); - if (this.parentBlock_) { - // Push this block to the very top of the stack. - this.unplug(); + + var disconnectEffect = !!this.parentBlock_; + // If in a stack, either split the stack, or pull out single block. + var healStack = !Blockly.DRAG_STACK; + if (e.metaKey) { + healStack = !healStack; + } + // Push this block to the very top of the stack. + this.unplug(healStack); + if (disconnectEffect) { var group = this.getSvgRoot(); group.translate_ = 'translate(' + newXY.x + ',' + newXY.y + ')'; this.disconnectUiEffect(); diff --git a/core/constants.js b/core/constants.js index 0f327e2d9..5ee26e201 100644 --- a/core/constants.js +++ b/core/constants.js @@ -54,10 +54,16 @@ Blockly.LONGPRESS = 750; /** * Prevent a sound from playing if another sound preceded it within this many - * miliseconds. + * milliseconds. */ Blockly.SOUND_LIMIT = 100; +/** + * When dragging a block out of a stack, split the stack in two (true), or drag + * out the block healing the stack (false). + */ +Blockly.DRAG_STACK = true; + /** * The richness of block colours, regardless of the hue. * Must be in the range of 0 (inclusive) to 1 (exclusive). From c68684dda64340565b2218cbe7573f4cb1e7c1d6 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Mon, 9 Jan 2017 22:55:17 -0800 Subject: [PATCH 2/2] Expand stack-drag modifier key to include alt and ctrl. --- core/block_svg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/block_svg.js b/core/block_svg.js index 95120a284..3cc1a59ac 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -954,7 +954,7 @@ Blockly.BlockSvg.prototype.onMouseMove_ = function(e) { var disconnectEffect = !!this.parentBlock_; // If in a stack, either split the stack, or pull out single block. var healStack = !Blockly.DRAG_STACK; - if (e.metaKey) { + if (e.altKey || e.ctrlKey || e.metaKey) { healStack = !healStack; } // Push this block to the very top of the stack.