1
0
Fork 0

Update Vizia

This commit is contained in:
Robbert van der Helm 2022-10-08 15:21:01 +02:00
parent 71c7e00f2b
commit 33d956a96b
3 changed files with 12 additions and 12 deletions

View file

@ -1,5 +1,12 @@
/* Overrides for default VIZIA widgets */ /* Overrides for default VIZIA widgets */
:root {
background-color: #fafafa;
color: #0a0a0a;
/* VIZIA uses points instead of pixels, this is 20px */
font-size: 15;
}
scrollview > vstack { scrollview > vstack {
/* Normally the scroll bar overlaps with the content, so we'll add a little offset to prevent that */ /* Normally the scroll bar overlaps with the content, so we'll add a little offset to prevent that */
child-right: 15px; child-right: 15px;

View file

@ -190,16 +190,6 @@ impl Editor for ViziaEditor {
// lower seems to compensate for this. // lower seems to compensate for this.
assets::register_fonts(cx); assets::register_fonts(cx);
cx.set_default_font(assets::NOTO_SANS_LIGHT); cx.set_default_font(assets::NOTO_SANS_LIGHT);
// TOOD: `:root { background-color: #fafafa; }` in a stylesheet doesn't work
cx.style
.background_color
.insert(Entity::root(), Color::rgb(250, 250, 250));
cx.style
.font_color
.insert(Entity::root(), Color::rgb(10, 10, 10));
// VIZIA uses points instead of pixels, this is 20px
cx.style.font_size.insert(Entity::root(), 15.0);
cx.add_theme(include_str!("../assets/theme.css")); cx.add_theme(include_str!("../assets/theme.css"));
// There doesn't seem to be any way to bundle styles with a widget, so we'll always // There doesn't seem to be any way to bundle styles with a widget, so we'll always

View file

@ -96,8 +96,11 @@ impl PeakMeter {
Element::new(cx).class("ticks__tick"); Element::new(cx).class("ticks__tick");
} }
let font_size = cx.style.font_size.get(cx.current()).unwrap_or(&15.0) let font_size = {
* cx.style.dpi_factor as f32; let current = cx.current();
let draw_cx = DrawContext::new(cx);
draw_cx.font_size(current) * draw_cx.style.dpi_factor as f32
};
let label = if first_tick { let label = if first_tick {
Label::new(cx, "-inf") Label::new(cx, "-inf")
.class("ticks__label") .class("ticks__label")