-
-
Notifications
You must be signed in to change notification settings - Fork 674
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
[widget audit] toga.Label #1799
Conversation
60c1d47
to
d0b3da0
Compare
else: | ||
self.native.setJustificationMode(LineBreaker.JUSTIFICATION_MODE_NONE) | ||
self.native.setGravity(Gravity.CENTER_VERTICAL | align(value)) | ||
self.native.setGravity(Gravity.CENTER_VERTICAL | align(value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the previous code, I wasn't sure whether setting a label to centered and then to justified would give you a result with short lines still centered. Turns out it doesn't, because the native widget's horizontal gravity defaults to LEFT if unspecified, but this isn't clearly documented, so it's better to be explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow what you're saying here. Isn't this setting horizontal gravity every time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is now, but previously it was leaving the horizontal gravity unspecified when value == JUSTIFY
.
Also visible in examples/resize on iOS:
|
Yeah - looks like a ZWS is the best approach here; I've implemented that, and also updated the implementation to not use a shadow variable in the interface. I think the behavior on the resize app is now correct (or, at least, is arguably correct) - on macOS, the "empty" label renders with a tiny, but nonzero width; iOS doesn't have any width, but it does have a height, AFAICT. If you think there's value in having some visible appearance, it's easy enough to set the intrinsic width to I'm not sure what's going on with the line wrapping though. I can maybe see a way in which an existing layout with a short line of text that changes to a long line of text might cause a word wrap to occur... but I haven't been able to reproduce that behaviour in practice. I've modified the text examples to deliberately increase and decrease sizes, but I don't think that's enough to exercise the class of problem you're talking about. Have you got an explicit example that demonstrates this? |
I think this is the kind of minor difference between platforms which we can live with for now. |
It could be reproduced in examples/resize as follows:
I confirm this is fixed by the most recent commit. I'll create a separate issue about testing it. |
A testing and documentation audit of the
toga.Label
widget.Audit checklist