Skip to content

Commit

Permalink
De-shadow blocks that have been edited.
Browse files Browse the repository at this point in the history
  • Loading branch information
NeilFraser committed Oct 15, 2015
1 parent ded524f commit 9b26d0d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
22 changes: 11 additions & 11 deletions blockly_compressed.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,15 @@ Blockly.BlockSvg.prototype.setEditable = function(editable) {
}
};

/**
* Set whether this block is a shadow block or not.
* @param {boolean} shadow True if a shadow.
*/
Blockly.BlockSvg.prototype.setShadow = function(shadow) {
Blockly.BlockSvg.superClass_.setShadow.call(this, shadow);
this.updateColour();
};

/**
* Return the root node of the SVG or null if none exists.
* @return {Element} The root SVG node (probably a group).
Expand Down
1 change: 1 addition & 0 deletions core/field_checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Blockly.FieldCheckbox.prototype.showEditor_ = function() {
}
}
if (newState !== null) {
this.sourceBlock_.setShadow(false);
this.setValue(String(newState).toUpperCase());
}
};
1 change: 1 addition & 0 deletions core/field_colour.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ Blockly.FieldColour.prototype.showEditor_ = function() {
}
}
if (colour !== null) {
thisField.sourceBlock_.setShadow(false);
thisField.setValue(colour);
}
});
Expand Down
1 change: 1 addition & 0 deletions core/field_dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ Blockly.FieldDropdown.prototype.showEditor_ = function() {
}
}
if (value !== null) {
thisField.sourceBlock_.setShadow(false);
thisField.setValue(value);
}
}
Expand Down
1 change: 1 addition & 0 deletions core/field_textinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ Blockly.FieldTextInput.prototype.onHtmlInputChange_ = function(e) {
// Update source block.
var text = htmlInput.value;
if (text !== htmlInput.oldValue_) {
this.sourceBlock_.setShadow(false);
htmlInput.oldValue_ = text;
this.setText(text);
this.validate_();
Expand Down

0 comments on commit 9b26d0d

Please sign in to comment.