mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
Fix wrong width of field_dropdown with an image on Edge / IE (#1278)
This commit is contained in:
committed by
Rachel Fenichel
parent
4b9fc09fed
commit
4c4c8be142
@@ -413,6 +413,26 @@ Blockly.FieldDropdown.prototype.render_ = function() {
|
||||
this.size_.width + Blockly.BlockSvg.SEP_SPACE_X);
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the width of the field. Overrides field.prototype.updateWidth to
|
||||
* deal with image selections on IE and Edge. If the selected item is not an
|
||||
* image, or if the browser is not IE / Edge, this simply calls the parent
|
||||
* implementation.
|
||||
*/
|
||||
Blockly.FieldDropdown.prototype.updateWidth = function() {
|
||||
if (this.imageJson_ && (goog.userAgent.IE || goog.userAgent.EDGE)) {
|
||||
// Recalculate the full width.
|
||||
var arrowWidth = Blockly.Field.getCachedWidth(this.arrow_);
|
||||
var width = Number(this.imageJson_.width) + arrowWidth + Blockly.BlockSvg.SEP_SPACE_X;
|
||||
if (this.borderRect_) {
|
||||
this.borderRect_.setAttribute('width', width);
|
||||
}
|
||||
this.size_.width = width;
|
||||
} else {
|
||||
Blockly.Field.prototype.updateWidth.call(this);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Close the dropdown menu if this input is being deleted.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user