mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
* feat: Remove references to getFastTextWidth (#8277) * format
This commit is contained in:
@@ -835,12 +835,7 @@ export abstract class Field<T = any>
|
||||
|
||||
let contentWidth = 0;
|
||||
if (this.textElement_) {
|
||||
contentWidth = dom.getFastTextWidth(
|
||||
this.textElement_,
|
||||
constants!.FIELD_TEXT_FONTSIZE,
|
||||
constants!.FIELD_TEXT_FONTWEIGHT,
|
||||
constants!.FIELD_TEXT_FONTFAMILY,
|
||||
);
|
||||
contentWidth = dom.getTextWidth(this.textElement_);
|
||||
totalWidth += contentWidth;
|
||||
}
|
||||
if (!this.isFullBlockField()) {
|
||||
|
||||
@@ -532,12 +532,7 @@ export class FieldDropdown extends Field<string> {
|
||||
height / 2 - this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE / 2,
|
||||
);
|
||||
} else {
|
||||
arrowWidth = dom.getFastTextWidth(
|
||||
this.arrow as SVGTSpanElement,
|
||||
this.getConstants()!.FIELD_TEXT_FONTSIZE,
|
||||
this.getConstants()!.FIELD_TEXT_FONTWEIGHT,
|
||||
this.getConstants()!.FIELD_TEXT_FONTFAMILY,
|
||||
);
|
||||
arrowWidth = dom.getTextWidth(this.arrow as SVGTSpanElement);
|
||||
}
|
||||
this.size_.width = imageWidth + arrowWidth + xPadding * 2;
|
||||
this.size_.height = height;
|
||||
@@ -570,12 +565,7 @@ export class FieldDropdown extends Field<string> {
|
||||
hasBorder ? this.getConstants()!.FIELD_DROPDOWN_BORDER_RECT_HEIGHT : 0,
|
||||
this.getConstants()!.FIELD_TEXT_HEIGHT,
|
||||
);
|
||||
const textWidth = dom.getFastTextWidth(
|
||||
this.getTextElement(),
|
||||
this.getConstants()!.FIELD_TEXT_FONTSIZE,
|
||||
this.getConstants()!.FIELD_TEXT_FONTWEIGHT,
|
||||
this.getConstants()!.FIELD_TEXT_FONTFAMILY,
|
||||
);
|
||||
const textWidth = dom.getTextWidth(this.getTextElement());
|
||||
const xPadding = hasBorder
|
||||
? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING
|
||||
: 0;
|
||||
|
||||
Reference in New Issue
Block a user