Skip to content

Instantly share code, notes, and snippets.

@abbas-oveissi
Created February 28, 2020 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abbas-oveissi/92ffdb3ad2caf07e4df96af695f4836b to your computer and use it in GitHub Desktop.
Save abbas-oveissi/92ffdb3ad2caf07e4df96af695f4836b to your computer and use it in GitHub Desktop.
if (boring == null && isUndefined(desiredWidth) && desiredWidth <= width) {
// Is used when the width is not known and the text is not boring, ie. if it contains
// unicode characters.
layout = new StaticLayout();
} else if (boring != null && boring.width <= width) {
// Is used for single-line, boring text when the width is either unknown or bigger
// than the width of the text.
layout = new BoringLayout();
} else {
// Is used for multiline, boring text and the width is known.
layout = new StaticLayout();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment