Skip to content

Commit

Permalink
Paragraphs: Use longestLine instead of minIntrinsicWidth (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnschulze authored Jan 18, 2022
1 parent ad6dd2b commit 6c5443b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions example/assets/simple/text_6.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified golden/simple/text_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added golden/simple/text_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions lib/src/vector_drawable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -542,12 +542,12 @@ class DrawableText implements Drawable {
switch (anchor) {
case DrawableTextAnchorPosition.middle:
return Offset(
offset.dx - paragraph.minIntrinsicWidth / 2,
offset.dx - paragraph.longestLine / 2,
offset.dy - paragraph.alphabeticBaseline,
);
case DrawableTextAnchorPosition.end:
return Offset(
offset.dx - paragraph.minIntrinsicWidth,
offset.dx - paragraph.longestLine,
offset.dy - paragraph.alphabeticBaseline,
);
case DrawableTextAnchorPosition.start:
Expand Down
Binary file modified test/golden_widget/text_color_filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6c5443b

Please sign in to comment.