Merge pull request #809 from google/paternity

Option for moving one block from stack.
This commit is contained in:
Rachel Fenichel
2017-02-22 10:39:11 -08:00
committed by GitHub
2 changed files with 17 additions and 4 deletions

View File

@@ -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();

View File

@@ -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).