mirror of
https://github.com/danbulant/cushy
synced 2026-07-05 19:20:36 +00:00
Bug fixes
This commit is contained in:
parent
15480ba68b
commit
b63e4d66d2
4 changed files with 17 additions and 3 deletions
|
|
@ -17,8 +17,8 @@ use kludgine::{Color, Kludgine};
|
||||||
use crate::context::sealed::WindowHandle;
|
use crate::context::sealed::WindowHandle;
|
||||||
use crate::graphics::Graphics;
|
use crate::graphics::Graphics;
|
||||||
use crate::styles::components::{
|
use crate::styles::components::{
|
||||||
CornerRadius, FontFamily, FontStyle, FontWeight, HighlightColor, LayoutOrder, TextSize,
|
CornerRadius, FontFamily, FontStyle, FontWeight, HighlightColor, LayoutOrder, LineHeight,
|
||||||
WidgetBackground,
|
TextSize, WidgetBackground,
|
||||||
};
|
};
|
||||||
use crate::styles::{ComponentDefinition, Styles, Theme, ThemePair};
|
use crate::styles::{ComponentDefinition, Styles, Theme, ThemePair};
|
||||||
use crate::utils::IgnorePoison;
|
use crate::utils::IgnorePoison;
|
||||||
|
|
@ -618,6 +618,7 @@ impl<'context, 'window, 'clip, 'gfx, 'pass> GraphicsContext<'context, 'window, '
|
||||||
self.gfx
|
self.gfx
|
||||||
.set_available_font_family(&self.widget.get(&FontFamily));
|
.set_available_font_family(&self.widget.get(&FontFamily));
|
||||||
self.gfx.set_font_size(self.widget.get(&TextSize));
|
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_style(self.widget.get(&FontStyle));
|
||||||
self.gfx.set_font_weight(self.widget.get(&FontWeight));
|
self.gfx.set_font_weight(self.widget.get(&FontWeight));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.
|
/// A set of light and dark [`Theme`]s.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ThemePair {
|
pub struct ThemePair {
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ impl Label {
|
||||||
|| ((*prepared_width < width || prepared.size.width <= width)
|
|| ((*prepared_width < width || prepared.size.width <= width)
|
||||||
&& prepared.line_height == prepared.size.height)) => {}
|
&& prepared.line_height == prepared.size.height)) => {}
|
||||||
_ => {
|
_ => {
|
||||||
|
context.apply_current_font_settings();
|
||||||
let measured = self.text.map(|text| {
|
let measured = self.text.map(|text| {
|
||||||
context
|
context
|
||||||
.gfx
|
.gfx
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ impl Widget for Scroll {
|
||||||
MouseScrollDelta::LineDelta(x, y) => Point::new(x, y) * self.line_height.into_float(),
|
MouseScrollDelta::LineDelta(x, y) => Point::new(x, y) * self.line_height.into_float(),
|
||||||
MouseScrollDelta::PixelDelta(px) => Point::new(px.x.cast(), px.y.cast()),
|
MouseScrollDelta::PixelDelta(px) => Point::new(px.x.cast(), px.y.cast()),
|
||||||
};
|
};
|
||||||
|
context.invalidate_when_changed(&self.scroll);
|
||||||
let mut scroll = self.scroll.lock();
|
let mut scroll = self.scroll.lock();
|
||||||
let old_scroll = *scroll;
|
let old_scroll = *scroll;
|
||||||
let new_scroll = Self::constrained_scroll(*scroll + amount.cast(), self.max_scroll.get());
|
let new_scroll = Self::constrained_scroll(*scroll + amount.cast(), self.max_scroll.get());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue