mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
More field dispose (#3201)
* Dispose of element references in fields. * Fewer warnings
This commit is contained in:
@@ -83,6 +83,39 @@ Blockly.FieldAngle = function(opt_value, opt_validator, opt_config) {
|
||||
|
||||
Blockly.FieldAngle.superClass_.constructor.call(
|
||||
this, opt_value || 0, opt_validator, opt_config);
|
||||
|
||||
/**
|
||||
* The angle picker's gauge path depending on the value.
|
||||
* @type {SVGElement}
|
||||
*/
|
||||
this.gauge_ = null;
|
||||
|
||||
/**
|
||||
* The angle picker's line drawn representing the value's angle.
|
||||
* @type {SVGElement}
|
||||
*/
|
||||
this.line_ = null;
|
||||
|
||||
/**
|
||||
* Wrapper click event data.
|
||||
* @type {?Blockly.EventData}
|
||||
* @private
|
||||
*/
|
||||
this.clickWrapper_ = null;
|
||||
|
||||
/**
|
||||
* Surface click event data.
|
||||
* @type {?Blockly.EventData}
|
||||
* @private
|
||||
*/
|
||||
this.clickSurfaceWrapper_ = null;
|
||||
|
||||
/**
|
||||
* Surface mouse move event data.
|
||||
* @type {?Blockly.EventData}
|
||||
* @private
|
||||
*/
|
||||
this.moveSurfaceWrapper_ = null;
|
||||
};
|
||||
Blockly.utils.object.inherits(Blockly.FieldAngle, Blockly.FieldTextInput);
|
||||
|
||||
@@ -309,9 +342,15 @@ Blockly.FieldAngle.prototype.dropdownCreate_ = function() {
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldAngle.prototype.dropdownDispose_ = function() {
|
||||
Blockly.unbindEvent_(this.clickWrapper_);
|
||||
Blockly.unbindEvent_(this.clickSurfaceWrapper_);
|
||||
Blockly.unbindEvent_(this.moveSurfaceWrapper_);
|
||||
if (this.clickWrapper_) {
|
||||
Blockly.unbindEvent_(this.clickWrapper_);
|
||||
}
|
||||
if (this.clickSurfaceWrapper_) {
|
||||
Blockly.unbindEvent_(this.clickSurfaceWrapper_);
|
||||
}
|
||||
if (this.moveSurfaceWrapper_) {
|
||||
Blockly.unbindEvent_(this.moveSurfaceWrapper_);
|
||||
}
|
||||
this.gauge_ = null;
|
||||
this.line_ = null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user