mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-14 06:59:01 -04:00
Merge remote-tracking branch 'Google/master' into google-master-april-1
# Conflicts: # blockly_compressed_horizontal.js # blockly_uncompressed_vertical.js # blocks_compressed.js # core/block.js # core/block_svg.js # core/blockly.js # core/connection.js # core/field_textinput.js # core/workspace_svg.js # generators/lua/lists.js # generators/lua/text.js # msg/js/he.js # msg/js/id.js # msg/js/sr.js # msg/js/zh-hant.js # msg/json/en.json
This commit is contained in:
commit
a65109f423
134 changed files with 1952 additions and 1235 deletions
core
|
@ -187,7 +187,7 @@ Blockly.Block.prototype.colourTertiary_ = '#000000';
|
|||
Blockly.Block.prototype.dispose = function(healStack) {
|
||||
// Terminate onchange event calls.
|
||||
if (this.onchangeWrapper_) {
|
||||
this.workspace.removeChangeListener(this.onchangeWrapper_)
|
||||
this.workspace.removeChangeListener(this.onchangeWrapper_);
|
||||
}
|
||||
this.unplug(healStack);
|
||||
if (Blockly.Events.isEnabled()) {
|
||||
|
@ -329,7 +329,7 @@ Blockly.Block.prototype.bumpNeighbours_ = function() {
|
|||
if (!this.workspace) {
|
||||
return; // Deleted block.
|
||||
}
|
||||
if (Blockly.dragMode_ != 0) {
|
||||
if (Blockly.dragMode_ != Blockly.DRAG_NONE) {
|
||||
return; // Don't bump blocks during a drag.
|
||||
}
|
||||
var rootBlock = this.getRootBlock();
|
||||
|
@ -350,7 +350,7 @@ Blockly.Block.prototype.bumpNeighbours_ = function() {
|
|||
// either one of them is unconnected, then there could be confusion.
|
||||
if (!connection.targetConnection || !otherConnection.targetConnection) {
|
||||
// Only bump blocks if they are from different tree structures.
|
||||
if (otherConnection.sourceBlock_.getRootBlock() != rootBlock) {
|
||||
if (otherConnection.getSourceBlock().getRootBlock() != rootBlock) {
|
||||
// Always bump the inferior block.
|
||||
if (connection.isSuperior()) {
|
||||
otherConnection.bumpAwayFrom_(connection);
|
||||
|
@ -380,7 +380,7 @@ Blockly.Block.prototype.getParent = function() {
|
|||
Blockly.Block.prototype.getInputWithBlock = function(block) {
|
||||
for (var i = 0, input; input = this.inputList[i]; i++) {
|
||||
if (input.connection && input.connection.targetBlock() == block) {
|
||||
return input
|
||||
return input;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -1355,8 +1355,15 @@ Blockly.Block.prototype.removeInput = function(name, opt_quiet) {
|
|||
for (var i = 0, input; input = this.inputList[i]; i++) {
|
||||
if (input.name == name) {
|
||||
if (input.connection && input.connection.targetConnection) {
|
||||
// Disconnect any attached block.
|
||||
input.connection.targetBlock().unplug();
|
||||
input.connection.setShadowDom(null);
|
||||
var block = input.connection.targetBlock();
|
||||
if (block.isShadow()) {
|
||||
// Destroy any attached shadow block.
|
||||
block.dispose();
|
||||
} else {
|
||||
// Disconnect any attached normal block.
|
||||
block.unplug();
|
||||
}
|
||||
}
|
||||
input.dispose();
|
||||
this.inputList.splice(i, 1);
|
||||
|
@ -1376,7 +1383,7 @@ Blockly.Block.prototype.removeInput = function(name, opt_quiet) {
|
|||
/**
|
||||
* Fetches the named input object.
|
||||
* @param {string} name The name of the input.
|
||||
* @return {Blockly.Input} The input object, or null of the input does not exist.
|
||||
* @return {Blockly.Input} The input object, or null if input does not exist.
|
||||
*/
|
||||
Blockly.Block.prototype.getInput = function(name) {
|
||||
for (var i = 0, input; input = this.inputList[i]; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue