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 {
|
impl Layout {
|
||||||
pub fn draw(&self, cache: &TextCache, ctx: &DrawContext) {
|
pub fn draw(&self, cache: &TextCache, ctx: &DrawContext, scale: f32, line_height: f32) {
|
||||||
let line_height = 12.0;
|
|
||||||
let mut cursor = Vec2::ZERO;
|
let mut cursor = Vec2::ZERO;
|
||||||
for line in self.lines.iter() {
|
for line in self.lines.iter() {
|
||||||
let ctx = ctx.with_offset(cursor);
|
let ctx = ctx.with_offset(cursor);
|
||||||
line.draw(cache, &ctx);
|
line.draw(cache, &ctx, scale);
|
||||||
cursor.y += line_height;
|
cursor.y += line_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,8 +208,7 @@ impl Line {
|
||||||
Self { fragments }
|
Self { fragments }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw(&self, cache: &TextCache, ctx: &DrawContext) {
|
pub fn draw(&self, cache: &TextCache, ctx: &DrawContext, scale: f32) {
|
||||||
let scale = 10.0;
|
|
||||||
let mut cursor = Vec2::ZERO;
|
let mut cursor = Vec2::ZERO;
|
||||||
for fragment in self.fragments.iter() {
|
for fragment in self.fragments.iter() {
|
||||||
if !fragment.hidden {
|
if !fragment.hidden {
|
||||||
|
|
Loading…
Reference in New Issue