Skip to content

Commit

Permalink
fix: Remove references to getFastTextWidth (#8277) (#8307)
Browse files Browse the repository at this point in the history
* feat: Remove references to getFastTextWidth (#8277)

* format
  • Loading branch information
ga-fleury authored Jul 22, 2024
1 parent 26e6d80 commit 58abf6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
7 changes: 1 addition & 6 deletions core/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
14 changes: 2 additions & 12 deletions core/field_dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 58abf6e

Please sign in to comment.