diff --git a/core/block_svg.js b/core/block_svg.js index 4745b8d32..7fc41293d 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -956,9 +956,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.altKey || e.ctrlKey || 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 d3fac8a62..f69531ee7 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).