mirror of
https://github.com/google/blockly.git
synced 2026-03-10 15:20:16 +01:00
Fix checkbox events. Fix block deletion while mutator is open.
This commit is contained in:
@@ -941,13 +941,13 @@ Blockly.BlockSvg.prototype.dispose = function(healStack, animate) {
|
||||
// Stop rerendering.
|
||||
this.rendered = false;
|
||||
|
||||
Blockly.BlockSvg.superClass_.dispose.call(this, healStack);
|
||||
Blockly.Events.disable();
|
||||
var icons = this.getIcons();
|
||||
for (var i = 0; i < icons.length; i++) {
|
||||
icons[i].dispose();
|
||||
}
|
||||
Blockly.Events.enable();
|
||||
Blockly.BlockSvg.superClass_.dispose.call(this, healStack);
|
||||
|
||||
goog.dom.removeNode(this.svgGroup_);
|
||||
// Sever JavaScript to DOM connections.
|
||||
|
||||
@@ -85,6 +85,10 @@ Blockly.FieldCheckbox.prototype.getValue = function() {
|
||||
Blockly.FieldCheckbox.prototype.setValue = function(strBool) {
|
||||
var newState = (strBool == 'TRUE');
|
||||
if (this.state_ !== newState) {
|
||||
if (this.sourceBlock_ && Blockly.Events.isEnabled()) {
|
||||
Blockly.Events.fire(new Blockly.Events.Change(
|
||||
this.sourceBlock_, 'field', this.name, this.state_, newState));
|
||||
}
|
||||
this.state_ = newState;
|
||||
if (this.checkElement_) {
|
||||
this.checkElement_.style.display = newState ? 'block' : 'none';
|
||||
|
||||
Reference in New Issue
Block a user