Add configurable textwrap scale and line height
This commit is contained in:
parent
c7981b5064
commit
70f9ca4405
|
@ -163,12 +163,11 @@ pub struct Layout {
|
|||
}
|
||||
|
||||
impl Layout {
|
||||
pub fn draw(&self, cache: &TextCache, ctx: &DrawContext) {
|
||||
let line_height = 12.0;
|
||||
pub fn draw(&self, cache: &TextCache, ctx: &DrawContext, scale: f32, line_height: f32) {
|
||||
let mut cursor = Vec2::ZERO;
|
||||
for line in self.lines.iter() {
|
||||
let ctx = ctx.with_offset(cursor);
|
||||
line.draw(cache, &ctx);
|
||||
line.draw(cache, &ctx, scale);
|
||||
cursor.y += line_height;
|
||||
}
|
||||
}
|
||||
|
@ -209,8 +208,7 @@ impl Line {
|
|||
Self { fragments }
|
||||
}
|
||||
|
||||
pub fn draw(&self, cache: &TextCache, ctx: &DrawContext) {
|
||||
let scale = 10.0;
|
||||
pub fn draw(&self, cache: &TextCache, ctx: &DrawContext, scale: f32) {
|
||||
let mut cursor = Vec2::ZERO;
|
||||
for fragment in self.fragments.iter() {
|
||||
if !fragment.hidden {
|
||||
|
|
Loading…
Reference in New Issue