Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchantey committed Feb 7, 2024
1 parent 4cf0d93 commit 09e0443
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion crates/forky/forky_web/src/dom_utils/bevy_canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ pub fn BevyCanvas(
} else {
create_node_ref()
};
view! { <canvas class="bevy-canvas" data-bevy="primary_window" node_ref=canvas_ref></canvas> }
view! { <canvas id="bevy-canvas" class="bevy-canvas" data-bevy="primary_window" node_ref=canvas_ref></canvas> }
}
38 changes: 19 additions & 19 deletions crates/gamai/src/ui/number_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -44,7 +44,7 @@ pub struct NumberField<T: NumberFieldValue> {
pub min: T,
pub max: T,
pub step: T,
pub display: NumberFieldDisplay,
pub variant: NumberFieldVariant,
}

impl<T: NumberFieldValue> Default for NumberField<T> {
Expand All @@ -54,7 +54,7 @@ impl<T: NumberFieldValue> Default for NumberField<T> {
min: T::from_i32(0).unwrap(),
max: T::from_i32(100).unwrap(),
step: T::from_i32(1).unwrap(),
display: Default::default(),
variant: Default::default(),
}
}
}
Expand All @@ -79,7 +79,7 @@ impl Into<NumberField<f64>> for NumberField<f32> {
min: self.min as f64,
max: self.max as f64,
step: self.step as f64,
display: self.display,
variant: self.variant,
}
}
}
Expand All @@ -96,26 +96,26 @@ impl<T: NumberFieldValue> NumberField<T> {
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(
reflect: FieldReflect<T>,
min: T,
max: T,
step: T,
display: NumberFieldDisplay,
variant: NumberFieldVariant,
) -> Self {
Self {
reflect,
display,
variant,
min,
max,
step,
Expand All @@ -140,7 +140,7 @@ impl<T: NumberFieldValue> Display for NumberField<T> {
.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()
}
}
Expand All @@ -149,7 +149,7 @@ impl IntoFieldUi for u8 {
fn into_field_ui(reflect: FieldReflect<Self>) -> FieldUi {
FieldUi::NumberU8(NumberField {
reflect,
display: NumberFieldDisplay::default(),
variant: NumberFieldVariant::default(),
min: Self::MIN,
max: Self::MAX,
step: 1,
Expand All @@ -161,7 +161,7 @@ impl IntoFieldUi for u16 {
fn into_field_ui(reflect: FieldReflect<Self>) -> FieldUi {
FieldUi::NumberU16(NumberField {
reflect,
display: NumberFieldDisplay::default(),
variant: NumberFieldVariant::default(),
min: 0,
max: 100,
step: 1,
Expand All @@ -173,7 +173,7 @@ impl IntoFieldUi for u32 {
fn into_field_ui(reflect: FieldReflect<Self>) -> FieldUi {
FieldUi::NumberU32(NumberField {
reflect,
display: NumberFieldDisplay::default(),
variant: NumberFieldVariant::default(),
min: 0,
max: 100,
step: 1,
Expand All @@ -185,7 +185,7 @@ impl IntoFieldUi for u64 {
fn into_field_ui(reflect: FieldReflect<Self>) -> FieldUi {
FieldUi::NumberU64(NumberField {
reflect,
display: NumberFieldDisplay::default(),
variant: NumberFieldVariant::default(),
min: 0,
max: 100,
step: 1,
Expand All @@ -197,7 +197,7 @@ impl IntoFieldUi for i8 {
fn into_field_ui(reflect: FieldReflect<Self>) -> FieldUi {
FieldUi::NumberI8(NumberField {
reflect,
display: NumberFieldDisplay::default(),
variant: NumberFieldVariant::default(),
min: 0,
max: 100,
step: 1,
Expand All @@ -209,7 +209,7 @@ impl IntoFieldUi for i16 {
fn into_field_ui(reflect: FieldReflect<Self>) -> FieldUi {
FieldUi::NumberI16(NumberField {
reflect,
display: NumberFieldDisplay::default(),
variant: NumberFieldVariant::default(),
min: 0,
max: 100,
step: 1,
Expand All @@ -221,7 +221,7 @@ impl IntoFieldUi for i32 {
fn into_field_ui(reflect: FieldReflect<Self>) -> FieldUi {
FieldUi::NumberI32(NumberField {
reflect,
display: NumberFieldDisplay::default(),
variant: NumberFieldVariant::default(),
min: 0,
max: 100,
step: 1,
Expand All @@ -233,7 +233,7 @@ impl IntoFieldUi for i64 {
fn into_field_ui(reflect: FieldReflect<Self>) -> FieldUi {
FieldUi::NumberI64(NumberField {
reflect,
display: NumberFieldDisplay::default(),
variant: NumberFieldVariant::default(),
min: 0,
max: 100,
step: 1,
Expand All @@ -245,7 +245,7 @@ impl IntoFieldUi for f32 {
fn into_field_ui(reflect: FieldReflect<Self>) -> FieldUi {
FieldUi::NumberF32(NumberField {
reflect,
display: NumberFieldDisplay::default(),
variant: NumberFieldVariant::default(),
min: 0.,
max: 100.,
step: 1.,
Expand All @@ -257,7 +257,7 @@ impl IntoFieldUi for f64 {
fn into_field_ui(reflect: FieldReflect<Self>) -> FieldUi {
FieldUi::NumberF64(NumberField {
reflect,
display: NumberFieldDisplay::default(),
variant: NumberFieldVariant::default(),
min: 0.,
max: 100.,
step: 1.,
Expand Down
2 changes: 1 addition & 1 deletion crates/gamai/test/ui/field_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<script type="module">
import init, * as mod from './wasm/bindgen.js'
window._sweet_wasm = mod
window._sweet_wasm = mod;
init()
.catch((error) => {
if (!error.message.startsWith("Using exceptions for control flow,"))
Expand Down

0 comments on commit 09e0443

Please sign in to comment.