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

Resolve mismatch between label width and alignment #727

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

DJMcNab
Copy link
Member

@DJMcNab DJMcNab commented Nov 5, 2024

If the alignment was set previously, and the CrossAxisAlignment was not Start, the width Parley believed we were in wouldn't match the width used for Masonry layout. This would lead to weird behaviour.

See the diff for the test images in 0a68159 for more context

Copy link
Contributor

@Philipp-M Philipp-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from nits, looks good to me.

@@ -11,7 +11,7 @@ use vello::peniko::BlendMode;
use vello::Scene;

use crate::text::{ArcStr, TextBrush, TextWithSelection};
use crate::widget::label::LABEL_X_PADDING;
use crate::widget::label::PROSE_X_PADDING;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it's called PROSE_X_PADDING and used here as well, maybe move it here alltogether?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, I didn't realise I re-used the import from both. I'll address it.

///
/// Note that setting [`alignment`](Prose::alignment) on the result
/// will be meaningless.
pub fn inline_prose(content: impl Into<ArcStr>) -> Prose {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe span instead as I think it's shorter and similar to the web equivalent?

But inline_prose on the other hand is descriptive.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a doc(alias) for now

Copy link
Contributor

@jaredoconnell jaredoconnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I appreciate the improved documentation. The tests look useful. I tested the http_cats example, and it works well.

@DJMcNab DJMcNab added this pull request to the merge queue Nov 6, 2024
Merged via the queue into linebender:main with commit ee31261 Nov 6, 2024
17 checks passed
@DJMcNab DJMcNab deleted the text-width branch November 6, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants