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

Feature Request: Add wordWrap Property to Text #3181

Open
eonarheim opened this issue Aug 27, 2024 Discussed in #3178 · 6 comments
Open

Feature Request: Add wordWrap Property to Text #3181

eonarheim opened this issue Aug 27, 2024 Discussed in #3178 · 6 comments
Labels
feature Label applied to new feature requests stale This issue or PR has not had any activity recently

Comments

@eonarheim
Copy link
Member

Discussed in #3178

Originally posted by ambmcmdmem626 August 24, 2024

Premise

When using the maxWidth property of Text, the text may wrap in the middle of a word.

image
const text = new Text({
  text: 'Apple Banana Chocolate',
  maxWidth: 100,
});

Main Request

I propose adding a wordWrap property to prevent words from wrapping in the middle.
What are your thoughts on this?

Based on 51ea101, it seems that a lot of changes might be needed...
Also, I can manage this by creating a wrapping method on the application side, so it’s not a high priority at all!

image
const text = new Text({
  text: 'Apple Banana Chocolate',
  maxWidth: 100,
  wordWrap: true
});
```</div>
@eonarheim eonarheim added the feature Label applied to new feature requests label Aug 27, 2024
@Autsider666
Copy link
Contributor

Sounds like a really useful feature!

The name wordWrap is probably clear enough for most people, but did you consider that it could potentially confuse people used to writing css? Because word-wrap does something else in css, where white-space is used for the effect you're describing.

@eonarheim
Copy link
Member Author

@Autsider666 Good point, I do like sticking to the CSS/webby way of referring to things. The fact that it does something completely different CSS makes me thing we should use whiteSpace instead and align with CSS.

Perhaps we should implement both the CSS wordWrap and whiteSpace?

@eonarheim
Copy link
Member Author

The CSS spec is very helpful here it details all the rules https://drafts.csswg.org/css-text/#white-space-property

@Autsider666
Copy link
Contributor

Perhaps we should implement both the CSS wordWrap and whiteSpace?

This is probably the best course of action if you want to stick to the same phrasing as css.

I really dislike the word choice for this specific feature in css though. I've to google it every time, because using whiteSpace feels so unintuitive for something that, to me, fits better with wordWrap (or even better: lineBreak)

@eonarheim
Copy link
Member Author

I really dislike the word choice for this specific feature in css though. I've to google it every time, because using whiteSpace feels so unintuitive for something that, to me, fits better with wordWrap (or even better: lineBreak)

I have the same feelings, it throws me every time. But I agree it's probably best to be consistent with CSS even if I don't agree with their name choices.

Copy link

github-actions bot commented Nov 1, 2024

This issue hasn't had any recent activity lately and is being marked as stale automatically.

@github-actions github-actions bot added the stale This issue or PR has not had any activity recently label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Label applied to new feature requests stale This issue or PR has not had any activity recently
Projects
None yet
Development

No branches or pull requests

2 participants