mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-18 08:02:27 +00:00
Ceil measured width for Text element
This commit is contained in:
parent
a30b47aa5f
commit
6929a71827
2 changed files with 10 additions and 1 deletions
|
@ -101,7 +101,12 @@ impl<V: 'static> Element<V> for Text<V> {
|
|||
.map(|line| line.wrap_count() + 1)
|
||||
.sum::<usize>();
|
||||
let size = Size {
|
||||
width: lines.iter().map(|line| line.layout.width).max().unwrap(),
|
||||
width: lines
|
||||
.iter()
|
||||
.map(|line| line.layout.width)
|
||||
.max()
|
||||
.unwrap()
|
||||
.ceil(),
|
||||
height: line_height * line_count,
|
||||
};
|
||||
|
||||
|
|
|
@ -785,6 +785,10 @@ impl Pixels {
|
|||
Self(self.0.round())
|
||||
}
|
||||
|
||||
pub fn ceil(&self) -> Self {
|
||||
Self(self.0.ceil())
|
||||
}
|
||||
|
||||
pub fn scale(&self, factor: f32) -> ScaledPixels {
|
||||
ScaledPixels(self.0 * factor)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue