Fix Tour for HiDPI (stub)
This commit is contained in:
parent
7b4fe6b7cc
commit
1e021fd034
2 changed files with 5 additions and 3 deletions
|
|
@ -76,7 +76,7 @@ impl Application for Tour {
|
|||
}
|
||||
|
||||
let element: Element<_> = Column::new()
|
||||
.max_width(Length::Units(540))
|
||||
.max_width(Length::Units((540.0*3.0) as u16))
|
||||
.spacing(20)
|
||||
.padding(20)
|
||||
.push(steps.view(self.debug).map(Message::StepMessage))
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ use wgpu_glyph::{GlyphCruncher, Section};
|
|||
use std::cell::RefCell;
|
||||
use std::f32;
|
||||
|
||||
pub const DEFAULT_TEXT_SIZE : f32 = 20.0*3.0;
|
||||
|
||||
impl text::Renderer for Renderer {
|
||||
fn node(&self, text: &Text) -> Node {
|
||||
let glyph_brush = self.glyph_brush.clone();
|
||||
|
|
@ -18,7 +20,7 @@ impl text::Renderer for Renderer {
|
|||
// I noticed that the first measure is the one that matters in
|
||||
// practice. Here, we use a RefCell to store the cached measurement.
|
||||
let measure = RefCell::new(None);
|
||||
let size = text.size.map(f32::from).unwrap_or(20.0);
|
||||
let size = text.size.map(f32::from).unwrap_or(DEFAULT_TEXT_SIZE);
|
||||
|
||||
let style = Style::default().width(text.width);
|
||||
|
||||
|
|
@ -71,7 +73,7 @@ impl text::Renderer for Renderer {
|
|||
(
|
||||
Primitive::Text {
|
||||
content: text.content.clone(),
|
||||
size: f32::from(text.size.unwrap_or(20)),
|
||||
size: text.size.map(f32::from).unwrap_or(DEFAULT_TEXT_SIZE),
|
||||
bounds: layout.bounds(),
|
||||
color: text.color.unwrap_or(Color::BLACK),
|
||||
horizontal_alignment: text.horizontal_alignment,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue