Skip to content
Snippets Groups Projects
Commit 7b76d319 authored by MrGVSV's avatar MrGVSV
Browse files

Formatting

parent 1eb7474b
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ pub struct Node { ...@@ -15,7 +15,7 @@ pub struct Node {
impl Node {} impl Node {}
pub struct NodeBuilder { pub struct NodeBuilder {
node: Node node: Node,
} }
impl NodeBuilder { impl NodeBuilder {
...@@ -26,8 +26,8 @@ impl NodeBuilder { ...@@ -26,8 +26,8 @@ impl NodeBuilder {
id: Index::default(), id: Index::default(),
resolved_styles: Style::default(), resolved_styles: Style::default(),
raw_styles: None, raw_styles: None,
z: 0.0 z: 0.0,
} },
} }
} }
...@@ -38,8 +38,8 @@ impl NodeBuilder { ...@@ -38,8 +38,8 @@ impl NodeBuilder {
id, id,
resolved_styles: styles, resolved_styles: styles,
raw_styles: None, raw_styles: None,
z: 0.0 z: 0.0,
} },
} }
} }
......
...@@ -21,8 +21,8 @@ pub enum StyleProp<T: Default + Clone> { ...@@ -21,8 +21,8 @@ pub enum StyleProp<T: Default + Clone> {
} }
impl<T> Default for StyleProp<T> impl<T> Default for StyleProp<T>
where where
T: Default + Clone, T: Default + Clone,
{ {
fn default() -> Self { fn default() -> Self {
Self::Unset Self::Unset
...@@ -30,8 +30,8 @@ impl<T> Default for StyleProp<T> ...@@ -30,8 +30,8 @@ impl<T> Default for StyleProp<T>
} }
impl<T> StyleProp<T> impl<T> StyleProp<T>
where where
T: Default + Clone, T: Default + Clone,
{ {
pub fn resolve(&self) -> T { pub fn resolve(&self) -> T {
match self { match self {
...@@ -48,7 +48,7 @@ impl<T> StyleProp<T> ...@@ -48,7 +48,7 @@ impl<T> StyleProp<T>
pub fn select<'a>(props: &'_ [&'a StyleProp<T>]) -> &'a Self { pub fn select<'a>(props: &'_ [&'a StyleProp<T>]) -> &'a Self {
for prop in props { for prop in props {
if !matches!(prop, StyleProp::Unset) { if !matches!(prop, StyleProp::Unset) {
return prop return prop;
} }
} }
...@@ -231,4 +231,4 @@ impl AsRefOption<Style> for &Option<Style> { ...@@ -231,4 +231,4 @@ impl AsRefOption<Style> for &Option<Style> {
fn as_ref_option(&self) -> Option<&Style> { fn as_ref_option(&self) -> Option<&Style> {
self.as_ref() self.as_ref()
} }
} }
\ No newline at end of file
use std::{
sync::{Arc, Mutex},
};
use indexmap::IndexSet; use indexmap::IndexSet;
use std::sync::{Arc, Mutex};
use crate::layout_cache::Rect; use crate::layout_cache::Rect;
use crate::{ use crate::{
......
...@@ -52,7 +52,7 @@ pub fn Button(props: ButtonProps) { ...@@ -52,7 +52,7 @@ pub fn Button(props: ButtonProps) {
padding_left: StyleProp::Value(Units::Stretch(1.0)), padding_left: StyleProp::Value(Units::Stretch(1.0)),
padding_right: StyleProp::Value(Units::Stretch(1.0)), padding_right: StyleProp::Value(Units::Stretch(1.0)),
..Default::default() ..Default::default()
}) }),
); );
rsx! { rsx! {
......
...@@ -95,7 +95,7 @@ pub fn TextBox(props: TextBoxProps) { ...@@ -95,7 +95,7 @@ pub fn TextBox(props: TextBoxProps) {
bottom: Units::Pixels(0.0).into(), bottom: Units::Pixels(0.0).into(),
height: Units::Pixels(26.0).into(), height: Units::Pixels(26.0).into(),
..Default::default() ..Default::default()
}) }),
); );
let background_styles = Style { let background_styles = Style {
......
...@@ -111,13 +111,17 @@ pub fn TooltipProvider(props: TooltipProviderProps) { ...@@ -111,13 +111,17 @@ pub fn TooltipProvider(props: TooltipProviderProps) {
width: StyleProp::Value(Units::Pixels(size.0)), width: StyleProp::Value(Units::Pixels(size.0)),
height: StyleProp::Value(Units::Pixels(size.1)), height: StyleProp::Value(Units::Pixels(size.1)),
..Default::default() ..Default::default()
}) }),
); );
let base_styles = props.styles.clone().unwrap(); let base_styles = props.styles.clone().unwrap();
let mut tooltip_styles = Style { let mut tooltip_styles = Style {
position_type: StyleProp::Value(PositionType::SelfDirected), position_type: StyleProp::Value(PositionType::SelfDirected),
background_color: StyleProp::select(&[&base_styles.background_color, &Color::new(0.13, 0.15, 0.17, 0.85).into()]).clone(), background_color: StyleProp::select(&[
&base_styles.background_color,
&Color::new(0.13, 0.15, 0.17, 0.85).into(),
])
.clone(),
width: StyleProp::Value(Units::Pixels(tooltip_size.0)), width: StyleProp::Value(Units::Pixels(tooltip_size.0)),
height: StyleProp::Value(Units::Pixels(tooltip_size.1)), height: StyleProp::Value(Units::Pixels(tooltip_size.1)),
..Style::default() ..Style::default()
...@@ -206,7 +210,7 @@ pub fn TooltipConsumer(props: TooltipConsumerProps) { ...@@ -206,7 +210,7 @@ pub fn TooltipConsumer(props: TooltipConsumerProps) {
width: StyleProp::Value(Units::Auto), width: StyleProp::Value(Units::Auto),
height: StyleProp::Value(Units::Auto), height: StyleProp::Value(Units::Auto),
..Default::default() ..Default::default()
}) }),
); );
let data = context let data = context
......
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