@@ -11,7 +11,7 @@ use utils::*;
1111
1212use bevy:: { prelude:: * , ui:: Pressed } ;
1313use haalka:: { impl_haalka_methods, prelude:: * } ;
14- use std:: { fmt:: Display , i32 } ;
14+ use std:: fmt:: Display ;
1515use strum:: { Display as StrumDisplay , EnumIter , IntoEnumIterator } ;
1616
1717fn main ( ) {
@@ -50,7 +50,7 @@ fn main() {
5050 resolution : Resolution :: R1920x1080 ,
5151 texture_quality : Quality :: Medium ,
5252 shadow_quality : Quality :: Medium ,
53- anti_aliasing : Some ( AntiAliasing :: TAA ) ,
53+ anti_aliasing : Some ( AntiAliasing :: Taa ) ,
5454 } )
5555 . run ( ) ;
5656}
@@ -392,10 +392,10 @@ enum Resolution {
392392
393393#[ derive( Clone , Copy , PartialEq , StrumDisplay , EnumIter , Default ) ]
394394enum AntiAliasing {
395- FXAA ,
395+ Fxaa ,
396396 #[ default]
397- TAA ,
398- SMAA ,
397+ Taa ,
398+ Smaa ,
399399}
400400
401401/// Component to mark a button as selected (for external control)
@@ -508,20 +508,20 @@ impl Button {
508508 self
509509 }
510510
511- fn selected_signal ( mut self , selected : impl Signal < Item = bool > + Clone + Send + ' static ) -> Self {
511+ fn selected_signal ( mut self , selected : impl Signal < Item = bool > + Clone + ' static ) -> Self {
512512 self . el = self
513513 . el
514514 . component_signal ( selected. map_true_in ( || Selected ) . schedule :: < Update > ( ) ) ;
515515 self
516516 }
517517
518- fn hovered_signal ( mut self , hovered : impl Signal < Item = bool > + Clone + Send + ' static ) -> Self {
518+ fn hovered_signal ( mut self , hovered : impl Signal < Item = bool > + Clone + ' static ) -> Self {
519519 self . el = self . el . component_signal ( hovered. map_true_in ( || VirtualHovered ) ) ;
520520 self
521521 }
522522}
523523
524- fn text_button ( text_signal : impl Signal < Item = String > + Clone + Send + ' static ) -> Button {
524+ fn text_button ( text_signal : impl Signal < Item = String > + Clone + ' static ) -> Button {
525525 Button :: new ( )
526526 . body (
527527 El :: < Text > :: new ( )
@@ -644,7 +644,7 @@ impl Checkbox {
644644 }
645645 }
646646
647- fn checked_signal ( mut self , signal : impl Signal < Item = bool > + Clone + Send + ' static ) -> Self {
647+ fn checked_signal ( mut self , signal : impl Signal < Item = bool > + Clone + ' static ) -> Self {
648648 let task = signal
649649 . map (
650650 clone ! ( ( self . lazy_entity => lazy_entity) move |In ( checked) , checkeds: Query <& Checked >, mut commands: Commands | {
@@ -665,8 +665,9 @@ impl Checkbox {
665665 fn on_change < M > ( mut self , handler : impl IntoSystem < In < bool > , ( ) , M > + Send + Sync + ' static ) -> Self {
666666 let task = signal:: from_entity ( self . lazy_entity . clone ( ) )
667667 . has_component :: < Checked > ( )
668- . skip ( 1 ) // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
668+ // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
669669 // external sync
670+ . skip ( 1 )
670671 . dedupe ( )
671672 . map ( handler)
672673 . task ( ) ;
@@ -800,7 +801,7 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> RadioGroup<T> {
800801 }
801802 }
802803
803- fn selection_signal ( mut self , signal : impl Signal < Item = Option < T > > + Clone + Send + ' static ) -> Self {
804+ fn selection_signal ( mut self , signal : impl Signal < Item = Option < T > > + Clone + ' static ) -> Self {
804805 let task = signal
805806 . map (
806807 clone ! ( ( self . lazy_entity => lazy_entity, self . options => options) move |In ( selection_option) : In <Option <T >>,
@@ -821,8 +822,9 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> RadioGroup<T> {
821822 let task = signal:: from_component_changed :: < RadioSelection > ( self . lazy_entity . clone ( ) )
822823 . map_in ( deref_copied)
823824 . map_in ( clone ! ( ( self . options => options) move |i: Option <usize >| i. and_then( |i| options. get( i) . cloned( ) ) ) )
824- . skip ( 1 ) // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
825+ // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
825826 // external sync
827+ . skip ( 1 )
826828 . dedupe ( )
827829 . map ( handler)
828830 . task ( ) ;
@@ -1011,17 +1013,16 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> Spinner<T> {
10111013 self
10121014 }
10131015
1014- fn selection_signal ( mut self , signal : impl Signal < Item = T > + Clone + Send + ' static ) -> Self {
1016+ fn selection_signal ( mut self , signal : impl Signal < Item = T > + Clone + ' static ) -> Self {
10151017 let task = signal
10161018 . map (
10171019 clone ! ( ( self . lazy_entity => lazy_entity, self . options => options) move |In ( selection) : In <T >,
10181020 mut spinners: Query <& mut SpinnerSelection >| {
10191021 let mut selected = spinners. get_mut( * lazy_entity) . unwrap( ) ;
1020- if let Some ( i) = options. iter( ) . position( |option| * option == selection) {
1021- if selected. 0 != i {
1022+ if let Some ( i) = options. iter( ) . position( |option| * option == selection)
1023+ && selected. 0 != i {
10221024 selected. 0 = i;
10231025 }
1024- }
10251026 } ) ,
10261027 )
10271028 . task ( ) ;
@@ -1032,8 +1033,9 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> Spinner<T> {
10321033 fn on_change < M > ( mut self , handler : impl IntoSystem < In < T > , ( ) , M > + Send + Sync + ' static ) -> Self {
10331034 let task = signal:: from_component_changed :: < SpinnerSelection > ( self . lazy_entity . clone ( ) )
10341035 . map_in ( deref_copied)
1035- . skip ( 1 ) // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
1036+ // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
10361037 // external sync
1038+ . skip ( 1 )
10371039 . dedupe ( )
10381040 . map_in ( clone ! ( ( self . options => options) move |i: usize | options. get( i) . cloned( ) . unwrap( ) ) )
10391041 . map ( handler)
@@ -1077,8 +1079,7 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> ElementWrapper for
10771079 } ) )
10781080 . observe ( spinner_input_observer)
10791081 . with_node ( |mut node| node. column_gap = Val :: Px ( BASE_PADDING * 2. ) )
1080- . item ( {
1081- let num_options = num_options;
1082+ . item (
10821083 lil_button ( )
10831084 . apply ( register_as_spinner_button ( LeftRight :: Left ) )
10841085 . on_click (
@@ -1089,8 +1090,8 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> ElementWrapper for
10891090 }
10901091 } ) ,
10911092 )
1092- . body ( arrow_text ( LeftRight :: Left ) )
1093- } )
1093+ . body ( arrow_text ( LeftRight :: Left ) ) ,
1094+ )
10941095 . item ( {
10951096 let options = options. clone ( ) ;
10961097 let mut text_el = El :: < Text > :: new ( )
@@ -1109,8 +1110,7 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> ElementWrapper for
11091110 }
11101111 text_el
11111112 } )
1112- . item ( {
1113- let num_options = num_options;
1113+ . item (
11141114 lil_button ( )
11151115 . apply ( register_as_spinner_button ( LeftRight :: Right ) )
11161116 . on_click (
@@ -1121,8 +1121,8 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> ElementWrapper for
11211121 }
11221122 } ) ,
11231123 )
1124- . body ( arrow_text ( LeftRight :: Right ) )
1125- } )
1124+ . body ( arrow_text ( LeftRight :: Right ) ) ,
1125+ )
11261126 }
11271127}
11281128
@@ -1160,7 +1160,7 @@ impl Slider {
11601160 }
11611161 }
11621162
1163- fn value_signal ( mut self , signal : impl Signal < Item = f32 > + Clone + Send + ' static ) -> Self {
1163+ fn value_signal ( mut self , signal : impl Signal < Item = f32 > + Clone + ' static ) -> Self {
11641164 let task = signal
11651165 . map ( clone ! ( ( self . lazy_entity => lazy_entity) move |In ( value) : In <f32 >,
11661166 mut sliders: Query <& mut SliderValue >,
@@ -1187,8 +1187,9 @@ impl Slider {
11871187 fn on_change < M > ( mut self , handler : impl IntoSystem < In < f32 > , ( ) , M > + Send + Sync + ' static ) -> Self {
11881188 let task = signal:: from_component_changed :: < SliderValue > ( self . lazy_entity . clone ( ) )
11891189 . map_in ( |slider| slider. value )
1190- . skip ( 1 ) // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
1190+ // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
11911191 // external sync
1192+ . skip ( 1 )
11921193 . dedupe ( )
11931194 . map ( handler)
11941195 . task ( ) ;
@@ -1430,8 +1431,7 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> Dropdown<T> {
14301431 self
14311432 }
14321433
1433- /// Sync the selection from an external signal
1434- fn selection_signal ( mut self , signal : impl Signal < Item = Option < T > > + Clone + Send + ' static ) -> Self {
1434+ fn selection_signal ( mut self , signal : impl Signal < Item = Option < T > > + Clone + ' static ) -> Self {
14351435 let task = signal
14361436 . map (
14371437 clone ! ( ( self . lazy_entity => lazy_entity, self . options => options) move |In ( selection_option) : In <Option <T >>,
@@ -1448,7 +1448,6 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> Dropdown<T> {
14481448 self
14491449 }
14501450
1451- /// Called when the selection changes
14521451 fn on_change < M > ( mut self , handler : impl IntoSystem < In < Option < T > > , ( ) , M > + Send + Sync + ' static ) -> Self {
14531452 let task = signal:: from_component_changed :: < DropdownSelectionIndex > ( self . lazy_entity . clone ( ) )
14541453 . map_in ( deref_copied)
0 commit comments