Bug fixes

This commit is contained in:
Jonathan Johnson 2023-11-22 18:53:41 -08:00
parent 15480ba68b
commit b63e4d66d2
No known key found for this signature in database
GPG key ID: A66D6A34D6620579
4 changed files with 17 additions and 3 deletions

View file

@ -17,8 +17,8 @@ use kludgine::{Color, Kludgine};
use crate::context::sealed::WindowHandle;
use crate::graphics::Graphics;
use crate::styles::components::{
CornerRadius, FontFamily, FontStyle, FontWeight, HighlightColor, LayoutOrder, TextSize,
WidgetBackground,
CornerRadius, FontFamily, FontStyle, FontWeight, HighlightColor, LayoutOrder, LineHeight,
TextSize, WidgetBackground,
};
use crate::styles::{ComponentDefinition, Styles, Theme, ThemePair};
use crate::utils::IgnorePoison;
@ -618,6 +618,7 @@ impl<'context, 'window, 'clip, 'gfx, 'pass> GraphicsContext<'context, 'window, '
self.gfx
.set_available_font_family(&self.widget.get(&FontFamily));
self.gfx.set_font_size(self.widget.get(&TextSize));
self.gfx.set_line_height(self.widget.get(&LineHeight));
self.gfx.set_font_style(self.widget.get(&FontStyle));
self.gfx.set_font_weight(self.widget.get(&FontWeight));
}

View file

@ -1099,6 +1099,18 @@ impl IntoValue<Edges<Dimension>> for Lp {
}
}
impl IntoValue<Dimension> for Px {
fn into_value(self) -> Value<Dimension> {
Dimension::from(self).into_value()
}
}
impl IntoValue<Dimension> for Lp {
fn into_value(self) -> Value<Dimension> {
Dimension::from(self).into_value()
}
}
/// A set of light and dark [`Theme`]s.
#[derive(Clone, Debug)]
pub struct ThemePair {

View file

@ -43,6 +43,7 @@ impl Label {
|| ((*prepared_width < width || prepared.size.width <= width)
&& prepared.line_height == prepared.size.height)) => {}
_ => {
context.apply_current_font_settings();
let measured = self.text.map(|text| {
context
.gfx

View file

@ -261,7 +261,7 @@ impl Widget for Scroll {
MouseScrollDelta::LineDelta(x, y) => Point::new(x, y) * self.line_height.into_float(),
MouseScrollDelta::PixelDelta(px) => Point::new(px.x.cast(), px.y.cast()),
};
context.invalidate_when_changed(&self.scroll);
let mut scroll = self.scroll.lock();
let old_scroll = *scroll;
let new_scroll = Self::constrained_scroll(*scroll + amount.cast(), self.max_scroll.get());