From 09e0443bef141ffad7421b8829fb77ed32adb657 Mon Sep 17 00:00:00 2001 From: Peter Hayman Date: Wed, 7 Feb 2024 18:26:14 +1100 Subject: [PATCH] patch --- .../forky_web/src/dom_utils/bevy_canvas.rs | 2 +- crates/gamai/src/ui/number_field.rs | 38 +++++++++---------- crates/gamai/test/ui/field_ui.rs | 2 +- html/index.html | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/crates/forky/forky_web/src/dom_utils/bevy_canvas.rs b/crates/forky/forky_web/src/dom_utils/bevy_canvas.rs index 5cde03dc..7861f550 100644 --- a/crates/forky/forky_web/src/dom_utils/bevy_canvas.rs +++ b/crates/forky/forky_web/src/dom_utils/bevy_canvas.rs @@ -10,5 +10,5 @@ pub fn BevyCanvas( } else { create_node_ref() }; - view! { } + view! { } } diff --git a/crates/gamai/src/ui/number_field.rs b/crates/gamai/src/ui/number_field.rs index eee6d65e..cd300e53 100644 --- a/crates/gamai/src/ui/number_field.rs +++ b/crates/gamai/src/ui/number_field.rs @@ -8,7 +8,7 @@ use std::ops::DerefMut; use std::str::FromStr; #[derive(Debug, Clone, Default)] -pub enum NumberFieldDisplay { +pub enum NumberFieldVariant { Text, Slider, #[default] @@ -44,7 +44,7 @@ pub struct NumberField { pub min: T, pub max: T, pub step: T, - pub display: NumberFieldDisplay, + pub variant: NumberFieldVariant, } impl Default for NumberField { @@ -54,7 +54,7 @@ impl Default for NumberField { min: T::from_i32(0).unwrap(), max: T::from_i32(100).unwrap(), step: T::from_i32(1).unwrap(), - display: Default::default(), + variant: Default::default(), } } } @@ -79,7 +79,7 @@ impl Into> for NumberField { min: self.min as f64, max: self.max as f64, step: self.step as f64, - display: self.display, + variant: self.variant, } } } @@ -96,14 +96,14 @@ impl NumberField { min: T, max: T, step: T, - display: NumberFieldDisplay, + variant: NumberFieldVariant, ) -> Self { Self { reflect: FieldReflect::new(field_name, get_cb, set_cb), min, max, step, - display, + variant, } } pub fn from_reflect( @@ -111,11 +111,11 @@ impl NumberField { min: T, max: T, step: T, - display: NumberFieldDisplay, + variant: NumberFieldVariant, ) -> Self { Self { reflect, - display, + variant, min, max, step, @@ -140,7 +140,7 @@ impl Display for NumberField { .field("min", &self.min.to_string()) .field("max", &self.max.to_string()) .field("step", &self.step.to_string()) - .field("display", &self.display) + .field("display", &self.variant) .finish() } } @@ -149,7 +149,7 @@ impl IntoFieldUi for u8 { fn into_field_ui(reflect: FieldReflect) -> FieldUi { FieldUi::NumberU8(NumberField { reflect, - display: NumberFieldDisplay::default(), + variant: NumberFieldVariant::default(), min: Self::MIN, max: Self::MAX, step: 1, @@ -161,7 +161,7 @@ impl IntoFieldUi for u16 { fn into_field_ui(reflect: FieldReflect) -> FieldUi { FieldUi::NumberU16(NumberField { reflect, - display: NumberFieldDisplay::default(), + variant: NumberFieldVariant::default(), min: 0, max: 100, step: 1, @@ -173,7 +173,7 @@ impl IntoFieldUi for u32 { fn into_field_ui(reflect: FieldReflect) -> FieldUi { FieldUi::NumberU32(NumberField { reflect, - display: NumberFieldDisplay::default(), + variant: NumberFieldVariant::default(), min: 0, max: 100, step: 1, @@ -185,7 +185,7 @@ impl IntoFieldUi for u64 { fn into_field_ui(reflect: FieldReflect) -> FieldUi { FieldUi::NumberU64(NumberField { reflect, - display: NumberFieldDisplay::default(), + variant: NumberFieldVariant::default(), min: 0, max: 100, step: 1, @@ -197,7 +197,7 @@ impl IntoFieldUi for i8 { fn into_field_ui(reflect: FieldReflect) -> FieldUi { FieldUi::NumberI8(NumberField { reflect, - display: NumberFieldDisplay::default(), + variant: NumberFieldVariant::default(), min: 0, max: 100, step: 1, @@ -209,7 +209,7 @@ impl IntoFieldUi for i16 { fn into_field_ui(reflect: FieldReflect) -> FieldUi { FieldUi::NumberI16(NumberField { reflect, - display: NumberFieldDisplay::default(), + variant: NumberFieldVariant::default(), min: 0, max: 100, step: 1, @@ -221,7 +221,7 @@ impl IntoFieldUi for i32 { fn into_field_ui(reflect: FieldReflect) -> FieldUi { FieldUi::NumberI32(NumberField { reflect, - display: NumberFieldDisplay::default(), + variant: NumberFieldVariant::default(), min: 0, max: 100, step: 1, @@ -233,7 +233,7 @@ impl IntoFieldUi for i64 { fn into_field_ui(reflect: FieldReflect) -> FieldUi { FieldUi::NumberI64(NumberField { reflect, - display: NumberFieldDisplay::default(), + variant: NumberFieldVariant::default(), min: 0, max: 100, step: 1, @@ -245,7 +245,7 @@ impl IntoFieldUi for f32 { fn into_field_ui(reflect: FieldReflect) -> FieldUi { FieldUi::NumberF32(NumberField { reflect, - display: NumberFieldDisplay::default(), + variant: NumberFieldVariant::default(), min: 0., max: 100., step: 1., @@ -257,7 +257,7 @@ impl IntoFieldUi for f64 { fn into_field_ui(reflect: FieldReflect) -> FieldUi { FieldUi::NumberF64(NumberField { reflect, - display: NumberFieldDisplay::default(), + variant: NumberFieldVariant::default(), min: 0., max: 100., step: 1., diff --git a/crates/gamai/test/ui/field_ui.rs b/crates/gamai/test/ui/field_ui.rs index c5f0ab20..c71b28dc 100644 --- a/crates/gamai/test/ui/field_ui.rs +++ b/crates/gamai/test/ui/field_ui.rs @@ -6,7 +6,7 @@ use sweet::*; #[derive(Clone, FieldUi)] struct MyAction { - #[number(min = 0, max = 100, step = 1,display=NumberFieldDisplay::default())] + #[number(min = 0, max = 100, step = 1,display=NumberFieldVariant::default())] pub health: u32, pub score: Score, pub nested: NestedAction, diff --git a/html/index.html b/html/index.html index 17869cf1..618b0117 100644 --- a/html/index.html +++ b/html/index.html @@ -6,7 +6,7 @@