Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add handle to expose FormattedText of the text component #509

Open
dragoncoder047 opened this issue Nov 13, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@dragoncoder047
Copy link
Contributor

this would be useful to get the bounding boxes of the text and see where the user clicked

currently you have to do this if you want to account for everything the text could do to style the characters

const formattedText = formatText({
    text: this.text,
    pos: this.pos,
    scale: this.scale,
    angle: this.angle,
    color: this.color,
    opacity: this.opacity,
    fixed: this.fixed,
    shader: this.shader,
    uniform: this.uniform,
    outline: this.outline,
    font: this.font,
    size: this.textSize,
    align: this.align,
    width: this.width,
    lineSpacing: this.lineSpacing,
    letterSpacing: this.letterSpacing,
    anchor: this.anchor,
    transform: this.textTransform,
    styles: this.textStyles,
});

it can be simplified to

const formattedText = this.formattedText;

it is expensive to compute so at least it would be a getter, maybe a method

@dragoncoder047 dragoncoder047 added the enhancement New feature or request label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant