1- use std:: collections:: HashMap ;
2- use i_triangle:: i_overlay:: core:: overlay:: Overlay ;
3- use i_triangle:: i_overlay:: i_shape:: int:: count:: PointsCount ;
4- use i_triangle:: i_overlay:: i_float:: int:: rect:: IntRect ;
5- use iced:: widget:: scrollable;
6- use iced:: { Alignment , Length , Padding , Size , Vector } ;
7- use iced:: widget:: { Button , Column , Container , Row , Space , Text } ;
8- use crate :: app:: design;
91use crate :: app:: boolean:: control:: ModeOption ;
102use crate :: app:: boolean:: workspace:: WorkspaceState ;
3+ use crate :: app:: design;
114use crate :: app:: fill_option:: FillOption ;
12- use crate :: app:: main:: { EditorApp , AppMessage } ;
5+ use crate :: app:: main:: { AppMessage , EditorApp } ;
136use crate :: app:: solver_option:: SolverOption ;
14- use crate :: geom:: camera:: Camera ;
157use crate :: data:: boolean:: BooleanResource ;
8+ use crate :: geom:: camera:: Camera ;
169use crate :: point_editor:: point:: PathsToEditorPoints ;
1710use crate :: point_editor:: widget:: PointEditUpdate ;
11+ use i_triangle:: i_overlay:: core:: overlay:: Overlay ;
12+ use i_triangle:: i_overlay:: i_float:: int:: rect:: IntRect ;
13+ use i_triangle:: i_overlay:: i_shape:: int:: count:: PointsCount ;
14+ use iced:: widget:: scrollable;
15+ use iced:: widget:: { Button , Column , Container , Row , Space , Text } ;
16+ use iced:: { Alignment , Length , Padding , Size , Vector } ;
17+ use std:: collections:: HashMap ;
1818
1919pub ( crate ) struct BooleanState {
2020 pub ( crate ) test : usize ,
@@ -41,25 +41,31 @@ pub(crate) enum BooleanMessage {
4141impl EditorApp {
4242 fn boolean_sidebar ( & self ) -> Column < ' _ , AppMessage > {
4343 let count = self . app_resource . boolean . count ;
44- let mut column = Column :: new ( ) . push (
45- Space :: new ( )
46- . width ( Length :: Fill )
47- . height ( Length :: Fixed ( 2.0 ) ) ,
48- ) ;
44+ let mut column =
45+ Column :: new ( ) . push ( Space :: new ( ) . width ( Length :: Fill ) . height ( Length :: Fixed ( 2.0 ) ) ) ;
4946 for index in 0 ..count {
5047 let is_selected = self . state . boolean . test == index;
5148
5249 column = column. push (
5350 Container :: new (
5451 Button :: new (
5552 Text :: new ( format ! ( "test_{}" , index) )
56- . style ( if is_selected { design:: style_sidebar_text_selected } else { design:: style_sidebar_text } )
57- . size ( 14 )
53+ . style ( if is_selected {
54+ design:: style_sidebar_text_selected
55+ } else {
56+ design:: style_sidebar_text
57+ } )
58+ . size ( 14 ) ,
5859 )
59- . width ( Length :: Fill )
60- . on_press ( AppMessage :: Bool ( BooleanMessage :: TestSelected ( index) ) )
61- . style ( if is_selected { design:: style_sidebar_button_selected } else { design:: style_sidebar_button } )
62- ) . padding ( self . design . action_padding ( ) )
60+ . width ( Length :: Fill )
61+ . on_press ( AppMessage :: Bool ( BooleanMessage :: TestSelected ( index) ) )
62+ . style ( if is_selected {
63+ design:: style_sidebar_button_selected
64+ } else {
65+ design:: style_sidebar_button
66+ } ) ,
67+ )
68+ . padding ( self . design . action_padding ( ) ) ,
6369 ) ;
6470 }
6571
@@ -75,14 +81,15 @@ impl EditorApp {
7581 . height ( Length :: Shrink )
7682 . align_x ( Alignment :: Start )
7783 . padding ( Padding :: new ( 0.0 ) . right ( 8 ) )
78- . style ( design:: style_sidebar_background)
79- ) . direction ( scrollable:: Direction :: Vertical (
84+ . style ( design:: style_sidebar_background) ,
85+ )
86+ . direction ( scrollable:: Direction :: Vertical (
8087 scrollable:: Scrollbar :: new ( )
8188 . width ( 4 )
8289 . margin ( 0 )
8390 . scroller_width ( 4 )
8491 . anchor ( scrollable:: Anchor :: Start ) ,
85- ) )
92+ ) ) ,
8693 )
8794 . push ( self . boolean_workspace ( ) )
8895 }
@@ -101,7 +108,9 @@ impl EditorApp {
101108 }
102109
103110 fn boolean_set_test ( & mut self , index : usize ) {
104- self . state . boolean . load_test ( index, & mut self . app_resource . boolean ) ;
111+ self . state
112+ . boolean
113+ . load_test ( index, & mut self . app_resource . boolean ) ;
105114 self . state . boolean . update_solution ( ) ;
106115 }
107116
@@ -174,7 +183,8 @@ impl BooleanState {
174183 let editor_points = & mut self . workspace . points ;
175184
176185 if editor_points. is_empty ( ) {
177- editor_points. reserve ( test. clip_paths . points_count ( ) + test. subj_paths . points_count ( ) )
186+ editor_points
187+ . reserve ( test. clip_paths . points_count ( ) + test. subj_paths . points_count ( ) )
178188 } else {
179189 editor_points. clear ( ) ;
180190 }
@@ -204,10 +214,11 @@ impl BooleanState {
204214 let clip = & self . workspace . clip ;
205215 let fill_rule = self . fill . fill_rule ( ) ;
206216 match self . mode {
207- ModeOption :: Edit => { } ,
217+ ModeOption :: Edit => { }
208218 ModeOption :: Debug => {
209- self . workspace . vectors = Overlay :: with_contours ( subj, clip) . build_separate_vectors ( fill_rule) ;
210- } ,
219+ self . workspace . vectors =
220+ Overlay :: with_contours ( subj, clip) . build_separate_vectors ( fill_rule) ;
221+ }
211222 _ => {
212223 let overlay_rule = self . mode . overlay_rule ( ) . unwrap ( ) ;
213224 let solution = Overlay :: with_contours ( subj, clip) . overlay ( overlay_rule, fill_rule) ;
0 commit comments