mirror of https://github.com/wayvr-org/wayvr.git
tweaks
This commit is contained in:
parent
0a7f8340d7
commit
02f1de59b2
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
<!-- Toast title -->
|
||||
<div flex_direction="row" align_items="center" gap="8">
|
||||
<sprite src="icons/bell.svg" color="on_background_variant" min_width="32" min_height="32" max_width="32" max_height="32" flex_grow="1" />
|
||||
<label wrap="1" id="toast_title" color="on_background_variant" weight="bold" size="25" padding_left="16" padding_right="16" />
|
||||
<sprite src="icons/bell.svg" color="primary" min_width="32" min_height="32" max_width="32" max_height="32" flex_grow="1" />
|
||||
<label wrap="1" id="toast_title" color="primary" weight="bold" size="25" padding_left="16" padding_right="16" />
|
||||
</div>
|
||||
|
||||
<!-- A simple separator -->
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<template name="Device">
|
||||
<rectangle macro="decorative_rect" padding_top="4" padding_bottom="4" align_items="center" gap="8">
|
||||
<sprite width="32" height="32" src_builtin="${src}" color="on_background" />
|
||||
<label _source="battery" _device="${idx}" size="24" weight="bold" _low_color="danger" _normal_color="primary" _charging_color="secondary" />
|
||||
<label _source="battery" _device="${idx}" size="24" weight="bold" _low_color="danger" _normal_color="primary" _charging_color="tertiary" />
|
||||
</rectangle>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,24 +3,26 @@ use crate::{
|
|||
assets::AssetPath,
|
||||
color::{WguiColor, WguiColorName},
|
||||
components::{
|
||||
self, Component, ComponentBase, ComponentTrait, RefreshData,
|
||||
self,
|
||||
tooltip::{ComponentTooltip, TooltipTrait},
|
||||
Component, ComponentBase, ComponentTrait, RefreshData,
|
||||
},
|
||||
drawing::{self, Boundary},
|
||||
event::{CallbackDataCommon, EventListenerCollection, EventListenerID, EventListenerKind},
|
||||
i18n::Translation,
|
||||
layout::{WidgetID, WidgetPair},
|
||||
renderer_vk::{
|
||||
text::{FontWeight, TextStyle, custom_glyph::CustomGlyphData},
|
||||
text::{custom_glyph::CustomGlyphData, FontWeight, TextStyle},
|
||||
util::centered_matrix,
|
||||
},
|
||||
sound::WguiSoundType,
|
||||
widget::{
|
||||
self, ConstructEssentials, EventResult, WidgetData,
|
||||
self,
|
||||
label::{WidgetLabel, WidgetLabelParams},
|
||||
rectangle::{WidgetRectangle, WidgetRectangleParams},
|
||||
sprite::{WidgetSprite, WidgetSpriteParams},
|
||||
util::WLength,
|
||||
ConstructEssentials, EventResult, WidgetData,
|
||||
},
|
||||
};
|
||||
use glam::{Mat4, Vec2, Vec3};
|
||||
|
|
@ -29,7 +31,7 @@ use std::{
|
|||
rc::Rc,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use taffy::{AlignItems, JustifyContent, prelude::length};
|
||||
use taffy::{prelude::length, AlignItems, JustifyContent};
|
||||
|
||||
pub struct Params<'a> {
|
||||
pub text: Option<Translation>, // if unset, label will not be populated
|
||||
|
|
@ -38,8 +40,10 @@ pub struct Params<'a> {
|
|||
pub color: Option<WguiColor>,
|
||||
pub border: f32,
|
||||
pub border_color: Option<WguiColor>,
|
||||
pub hover_border_color: Option<WguiColor>,
|
||||
pub hover_color: Option<WguiColor>,
|
||||
pub hover_border_color: Option<WguiColor>,
|
||||
pub sticky_color: Option<WguiColor>,
|
||||
pub sticky_border_color: Option<WguiColor>,
|
||||
pub round: WLength,
|
||||
pub style: taffy::Style,
|
||||
pub text_style: TextStyle,
|
||||
|
|
@ -58,10 +62,12 @@ impl Default for Params<'_> {
|
|||
text: Some(Translation::from_raw_text("")),
|
||||
sprite_src: None,
|
||||
color: None,
|
||||
hover_color: None,
|
||||
border_color: None,
|
||||
border: 2.0,
|
||||
hover_color: None,
|
||||
hover_border_color: None,
|
||||
sticky_color: None,
|
||||
sticky_border_color: None,
|
||||
border: 2.0,
|
||||
round: WLength::Units(4.0),
|
||||
style: Default::default(),
|
||||
text_style: TextStyle::default(),
|
||||
|
|
@ -84,6 +90,8 @@ pub struct Colors {
|
|||
pub border_color: WguiColor,
|
||||
pub hover_color: WguiColor,
|
||||
pub hover_border_color: WguiColor,
|
||||
pub sticky_color: WguiColor,
|
||||
pub sticky_border_color: WguiColor,
|
||||
}
|
||||
|
||||
struct State {
|
||||
|
|
@ -478,6 +486,12 @@ pub fn construct(ess: &mut ConstructEssentials, params: Params) -> anyhow::Resul
|
|||
.hover_border_color
|
||||
.unwrap_or_else(|| border_color.add_rgb(0.5).add_alpha(0.5));
|
||||
|
||||
let sticky_color = params.hover_color.unwrap_or_else(|| color.add_rgb(0.15).add_alpha(0.1));
|
||||
|
||||
let sticky_border_color = params
|
||||
.hover_border_color
|
||||
.unwrap_or_else(|| border_color.add_rgb(0.25).add_alpha(0.35));
|
||||
|
||||
let gradient_intensity = theme.gradient_intensity;
|
||||
|
||||
drop(globals);
|
||||
|
|
@ -568,6 +582,8 @@ pub fn construct(ess: &mut ConstructEssentials, params: Params) -> anyhow::Resul
|
|||
border_color,
|
||||
hover_color,
|
||||
hover_border_color,
|
||||
sticky_color,
|
||||
sticky_border_color,
|
||||
},
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
use crate::{
|
||||
assets::AssetPath,
|
||||
color::WguiColor,
|
||||
components::{Component, button},
|
||||
components::{button, Component},
|
||||
i18n::Translation,
|
||||
layout::WidgetID,
|
||||
parser::{
|
||||
AttribPair, ParserContext, ParserFile, get_asset_path_from_kv,
|
||||
helpers::{TooltipAttribs, parse_attrib_tooltip},
|
||||
get_asset_path_from_kv,
|
||||
helpers::{parse_attrib_tooltip, TooltipAttribs},
|
||||
parse_children, parse_f32, process_component,
|
||||
style::{parse_color_opt, parse_round, parse_style, parse_text_style},
|
||||
AttribPair, ParserContext, ParserFile,
|
||||
},
|
||||
widget::util::WLength,
|
||||
};
|
||||
|
|
@ -27,6 +28,8 @@ pub fn parse_component_button<'a>(
|
|||
let mut border_color: Option<WguiColor> = None;
|
||||
let mut hover_color: Option<WguiColor> = None;
|
||||
let mut hover_border_color: Option<WguiColor> = None;
|
||||
let mut sticky_color: Option<WguiColor> = None;
|
||||
let mut sticky_border_color: Option<WguiColor> = None;
|
||||
let mut round = WLength::Units(4.0);
|
||||
let mut tooltip = TooltipAttribs::default();
|
||||
let mut sticky: bool = false;
|
||||
|
|
@ -79,6 +82,12 @@ pub fn parse_component_button<'a>(
|
|||
"hover_border_color" => {
|
||||
parse_color_opt(ctx, tag_name, key, value, &mut hover_border_color);
|
||||
}
|
||||
"sticky_color" => {
|
||||
parse_color_opt(ctx, tag_name, key, value, &mut sticky_color);
|
||||
}
|
||||
"sticky_border_color" => {
|
||||
parse_color_opt(ctx, tag_name, key, value, &mut sticky_border_color);
|
||||
}
|
||||
"sprite_src" | "sprite_src_ext" | "sprite_src_builtin" | "sprite_src_internal" => {
|
||||
let asset_path = get_asset_path_from_kv("sprite_", key, value);
|
||||
|
||||
|
|
@ -106,8 +115,10 @@ pub fn parse_component_button<'a>(
|
|||
color,
|
||||
border,
|
||||
border_color,
|
||||
hover_border_color,
|
||||
hover_color,
|
||||
hover_border_color,
|
||||
sticky_color,
|
||||
sticky_border_color,
|
||||
text: translation,
|
||||
style,
|
||||
text_style,
|
||||
|
|
|
|||
Loading…
Reference in New Issue