mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
Merge pull request #2241 from BeksOmega/fixes/DisabledContentsBlocks
RetrieveDisabled Blocks from the Trashcan
This commit is contained in:
@@ -595,6 +595,18 @@ Blockly.Flyout.prototype.onMouseDown_ = function(e) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Does this flyout allow you to create a new instance of the given block?
|
||||
* Used for deciding if a block can be "dragged out of" the flyout.
|
||||
* @param {!Blockly.BlockSvg} block The block to copy from the flyout.
|
||||
* @return {!boolean} True if you can create a new instance of the block, false
|
||||
* otherwise.
|
||||
* @package
|
||||
*/
|
||||
Blockly.Flyout.prototype.isBlockCreatable_ = function(block) {
|
||||
return !block.disabled;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a copy of this block on the workspace.
|
||||
* @param {!Blockly.BlockSvg} originalBlock The block to copy from the flyout.
|
||||
|
||||
@@ -327,8 +327,7 @@ Blockly.Gesture.prototype.updateDragDelta_ = function(currentXY) {
|
||||
* @private
|
||||
*/
|
||||
Blockly.Gesture.prototype.updateIsDraggingFromFlyout_ = function() {
|
||||
// Disabled blocks may not be dragged from the flyout.
|
||||
if (this.targetBlock_.disabled) {
|
||||
if (!this.flyout_.isBlockCreatable_(this.targetBlock_)) {
|
||||
return false;
|
||||
}
|
||||
if (!this.flyout_.isScrollable() ||
|
||||
|
||||
@@ -282,6 +282,11 @@ Blockly.Trashcan.prototype.init = function(verticalSpacing) {
|
||||
Blockly.utils.insertAfter(this.flyout_.createDom('svg'),
|
||||
this.workspace_.getParentSvg());
|
||||
this.flyout_.init(this.workspace_);
|
||||
this.flyout_.isBlockCreatable_ = function() {
|
||||
// All blocks, including disabled ones, can be dragged from the
|
||||
// trashcan flyout.
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
this.verticalSpacing_ = this.MARGIN_BOTTOM_ + verticalSpacing;
|
||||
|
||||
Reference in New Issue
Block a user