Skip to content
Snippets Groups Projects
Commit 1079bae5 authored by querat's avatar querat
Browse files

KButtonBundle's "styles" prop now accepts font_size

parent 4f077ffb
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,11 @@ fn current_count_render(
text: "Click me!".into(),
..Default::default()
}}
styles={KStyle {
font_size: StyleProp::Value(48.),
height: StyleProp::Value(Units::Pixels(64.)),
..default()
}}
on_event={OnEvent::new(
move |In((event_dispatcher_context, _, mut event, _entity)): In<(EventDispatcherContext, WidgetState, KEvent, Entity)>,
mut query: Query<&mut CurrentCountState>| {
......
......@@ -61,7 +61,19 @@ pub fn button_render(
) -> bool {
if let Ok((button, styles, mut computed_styles)) = query.get_mut(entity) {
let hover_color = Color::rgba(0.592, 0.627, 0.749, 1.0); //Color::rgba(0.549, 0.666, 0.933, 1.0);
// let color = Color::rgba(0.254, 0.270, 0.349, 1.0);
let font_size = if let StyleProp::Value(font_size) = styles.font_size {
font_size
} else {
16.
};
let height = if let StyleProp::Value(height) = styles.height {
height
} else {
Units::Pixels(28.0)
};
let state_entity =
widget_context.use_state(&mut commands, entity, ButtonState { hovering: false });
......@@ -81,7 +93,8 @@ pub fn button_render(
},
border: Edge::all(2.0).into(),
border_radius: StyleProp::Value(Corner::all(10.0)),
height: StyleProp::Value(Units::Pixels(28.0)),
font_size: StyleProp::Value(font_size).into(),
height: StyleProp::Value(height),
width: Units::Stretch(1.0).into(),
cursor: StyleProp::Value(KCursorIcon(CursorIcon::Hand)),
..Default::default()
......@@ -128,12 +141,12 @@ pub fn button_render(
bottom: Units::Stretch(1.0).into(),
left: Units::Stretch(1.0).into(),
right: Units::Stretch(1.0).into(),
font_size: StyleProp::Value(font_size),
..Default::default()
}}
text={TextProps {
alignment: Alignment::Start,
content: button.text.clone(),
size: 16.0,
..Default::default()
}}
/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment