fix: text bounds calculation
This commit is contained in:
parent
59fbf68c54
commit
4f80a7ad9e
1 changed files with 16 additions and 1 deletions
|
|
@ -95,8 +95,23 @@ impl Text {
|
||||||
Text::Cached {
|
Text::Cached {
|
||||||
bounds,
|
bounds,
|
||||||
clip_bounds,
|
clip_bounds,
|
||||||
|
align_y,
|
||||||
..
|
..
|
||||||
} => bounds.intersection(clip_bounds),
|
} => {
|
||||||
|
// XX Must account for alignment...
|
||||||
|
// Is this really how it should be handled though?
|
||||||
|
let mut bounds = *bounds;
|
||||||
|
match align_y {
|
||||||
|
alignment::Vertical::Center => {
|
||||||
|
bounds.y -= bounds.height / 2.;
|
||||||
|
}
|
||||||
|
alignment::Vertical::Bottom => {
|
||||||
|
bounds.y -= bounds.height;
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
};
|
||||||
|
bounds.intersection(clip_bounds)
|
||||||
|
}
|
||||||
Text::Raw { raw, .. } => Some(raw.clip_bounds),
|
Text::Raw { raw, .. } => Some(raw.clip_bounds),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue