@@ -149,7 +149,7 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
149149 . with_child ( Label :: new ( "Root Zoom:" ) . with_text_size ( 14.0 ) )
150150 . with_flex_spacer ( 1.0 )
151151 . with_child ( NoUpdateLabel :: new ( 24.0 ) . lens ( FractalData :: root_zoom. map ( |val| {
152- let output = if val. len ( ) > 0 {
152+ let output = if ! val. is_empty ( ) {
153153 extended_to_string_short ( string_to_extended ( val) )
154154 } else {
155155 String :: new ( )
@@ -282,21 +282,21 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
282282 . with_child ( Flex :: row ( )
283283 . with_child ( Label :: new ( "Direction:" ) . fix_width ( 100.0 ) )
284284 . with_flex_child ( Slider :: new ( )
285- . with_range ( 0.0 , 360 .0)
285+ . with_range ( 0.0 , 180 .0)
286286 . expand_width ( )
287- . lens ( FractalData :: lighting_direction) , 1.0 )
287+ . lens ( FractalData :: lighting_direction. map ( |val| * val / 2.0 , |new , val| * new = 2.0 * val . round ( ) ) ) , 1.0 )
288288 . with_child ( Label :: < f64 > :: new ( |data : & f64 , _env : & _ | {
289- format ! ( "{:>.3} " , * data)
289+ format ! ( "{:>3.0}° " , * data)
290290 } ) . lens ( FractalData :: lighting_direction) ) )
291291 . with_spacer ( 4.0 )
292292 . with_child ( Flex :: row ( )
293293 . with_child ( Label :: new ( "Azimuth:" ) . fix_width ( 100.0 ) )
294294 . with_flex_child ( Slider :: new ( )
295295 . with_range ( 0.0 , 90.0 )
296296 . expand_width ( )
297- . lens ( FractalData :: lighting_azimuth) , 1.0 )
297+ . lens ( FractalData :: lighting_azimuth. map ( |val| * val , |new , val| * new = val . round ( ) ) ) , 1.0 )
298298 . with_child ( Label :: < f64 > :: new ( |data : & f64 , _env : & _ | {
299- format ! ( "{:>.3} " , * data)
299+ format ! ( "{:>3.0}° " , * data)
300300 } ) . lens ( FractalData :: lighting_azimuth) ) )
301301 . with_spacer ( 4.0 )
302302 . with_child ( Flex :: row ( )
@@ -306,7 +306,7 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
306306 . expand_width ( )
307307 . lens ( FractalData :: lighting_opacity) , 1.0 )
308308 . with_child ( Label :: < f64 > :: new ( |data : & f64 , _env : & _ | {
309- format ! ( "{:>.3}" , * data)
309+ format ! ( "{:>4.1}%" , 100.0 * * data)
310310 } ) . lens ( FractalData :: lighting_opacity) ) )
311311 . with_spacer ( 4.0 )
312312 . with_child ( Flex :: row ( )
@@ -316,7 +316,7 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
316316 . expand_width ( )
317317 . lens ( FractalData :: lighting_ambient) , 1.0 )
318318 . with_child ( Label :: < f64 > :: new ( |data : & f64 , _env : & _ | {
319- format ! ( "{:>.3}" , * data)
319+ format ! ( "{:>4.1}%" , 100.0 * * data)
320320 } ) . lens ( FractalData :: lighting_ambient) ) )
321321 . with_spacer ( 4.0 )
322322 . with_child ( Flex :: row ( )
@@ -326,7 +326,7 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
326326 . expand_width ( )
327327 . lens ( FractalData :: lighting_diffuse) , 1.0 )
328328 . with_child ( Label :: < f64 > :: new ( |data : & f64 , _env : & _ | {
329- format ! ( "{:>.3}" , * data)
329+ format ! ( "{:>4.1}%" , 100.0 * * data)
330330 } ) . lens ( FractalData :: lighting_diffuse) ) )
331331 . with_spacer ( 4.0 )
332332 . with_child ( Flex :: row ( )
@@ -336,17 +336,17 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
336336 . expand_width ( )
337337 . lens ( FractalData :: lighting_specular) , 1.0 )
338338 . with_child ( Label :: < f64 > :: new ( |data : & f64 , _env : & _ | {
339- format ! ( "{:>.3}" , * data)
339+ format ! ( "{:>4.1}%" , 100.0 * * data)
340340 } ) . lens ( FractalData :: lighting_specular) ) )
341341 . with_spacer ( 4.0 )
342342 . with_child ( Flex :: row ( )
343343 . with_child ( Label :: new ( "Shininess:" ) . fix_width ( 100.0 ) )
344344 . with_flex_child ( Slider :: new ( )
345- . with_range ( 0.0 , 20 .0)
345+ . with_range ( 0.0 , 50 .0)
346346 . expand_width ( )
347347 . lens ( FractalData :: lighting_shininess. map ( |val| * val as f64 , |new, val| * new = val as i64 ) ) , 1.0 )
348348 . with_child ( Label :: < i64 > :: new ( |data : & i64 , _env : & _ | {
349- format ! ( "{:>3 }" , * data)
349+ format ! ( "{:>4 }" , * data)
350350 } ) . lens ( FractalData :: lighting_shininess) ) )
351351 . with_spacer ( 4.0 )
352352 . with_child ( Button :: new ( "SET" ) . on_click ( |ctx, _data : & mut FractalData , _env| {
@@ -451,25 +451,33 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
451451 . with_child ( Label :: new ( format ! ( "{} {} {}" , env!( "VERGEN_GIT_SHA_SHORT" ) , env!( "VERGEN_GIT_COMMIT_DATE" ) , env!( "VERGEN_GIT_COMMIT_TIME" ) ) ) )
452452 . with_child ( Label :: new ( format ! ( "{} {}" , env!( "VERGEN_RUSTC_SEMVER" ) , env!( "VERGEN_RUSTC_HOST_TRIPLE" ) ) ) ) ;
453453
454- let button_save_advanced_options = Button :: new ( "SAVE & UPDATE" ) . on_click ( |ctx, _data, _env| {
455- ctx. submit_command ( SET_ADVANCED_OPTIONS ) ;
456- } ) . expand_width ( ) . fix_height ( 40.0 ) ;
457-
458454 let group_advanced_options = Flex :: column ( )
459- . with_child ( create_checkbox_row ( "Show glitched pixels" ) . lens ( FractalData :: display_glitches) )
460- . with_spacer ( 4.0 )
461- . with_child ( create_checkbox_row ( "Enable series approximation" ) . lens ( FractalData :: series_approximation_enabled) )
455+ . with_child ( create_checkbox_row ( "Automatically adjust iterations" ) . lens ( FractalData :: auto_adjust_iterations) )
462456 . with_spacer ( 4.0 )
463- . with_child ( create_checkbox_row ( "Tiled series approximation " ) . lens ( FractalData :: series_approximation_tiled ) )
457+ . with_child ( create_checkbox_row ( "Remove image centre " ) . lens ( FractalData :: remove_centre ) )
464458 . with_spacer ( 4.0 )
465- . with_child ( create_checkbox_row ( "Jitter pixels" ) . lens ( FractalData :: jitter ) )
459+ . with_child ( create_checkbox_row ( "Show glitched pixels" ) . lens ( FractalData :: display_glitches ) )
466460 . with_spacer ( 4.0 )
467- . with_child ( create_checkbox_row ( "Automatically adjust iterations" ) . lens ( FractalData :: auto_adjust_iterations) )
461+ . with_child ( Flex :: row ( )
462+ . with_child ( Label :: new ( "Glitch tolerance:" ) )
463+ . with_flex_child ( Slider :: new ( )
464+ . with_range ( -8.0 , -3.0 )
465+ . expand_width ( )
466+ . lens ( FractalData :: glitch_tolerance. map (
467+ |val| ( * val) . log10 ( ) ,
468+ |val, new| * val = 10.0f64 . powf ( new. floor ( ) + ( ( 10.0 * 10.0f64 . powf ( new - new. floor ( ) ) ) . round ( ) / 10.0 ) . log10 ( ) ) ) ) , 1.0 )
469+ . with_child ( Label :: < f64 > :: new ( |data : & f64 , _env : & _ | {
470+ let temp = data. log10 ( ) ;
471+ let exponent = temp. floor ( ) ;
472+ let mantissa = 10.0f64 . powf ( temp - exponent) ;
473+
474+ format ! ( "{:.2}E{:1}" , mantissa, exponent)
475+ } ) . lens ( FractalData :: glitch_tolerance) ) )
468476 . with_spacer ( 4.0 )
469- . with_child ( create_checkbox_row ( "Remove image centre " ) . lens ( FractalData :: remove_centre ) )
477+ . with_child ( create_checkbox_row ( "Series approximation " ) . lens ( FractalData :: series_approximation_enabled ) )
470478 . with_spacer ( 4.0 )
471479 . with_child ( Flex :: row ( )
472- . with_child ( Label :: new ( "S.A. Order:" ) . fix_width ( 100.0 ) )
480+ . with_child ( Label :: new ( "Series order:" ) )
473481 . with_flex_child ( Slider :: new ( )
474482 . with_range ( 1.0 , 16.0 )
475483 . expand_width ( )
@@ -480,11 +488,36 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
480488 format ! ( "{:>3}" , * data)
481489 } ) . lens ( FractalData :: order) ) )
482490 . with_spacer ( 4.0 )
483- . with_child ( create_label_textbox_row ( "GLITCH TOL:" , 120.0 ) . lens ( FractalData :: glitch_tolerance) )
491+ . with_child ( create_checkbox_row ( "Tiled series approximation" ) . lens ( FractalData :: series_approximation_tiled) )
492+ . with_spacer ( 4.0 )
493+ . with_child ( Flex :: row ( )
494+ . with_child ( Label :: new ( "Tiled sampling:" ) )
495+ . with_flex_child ( Slider :: new ( )
496+ . with_range ( 1.0 , 100.0 )
497+ . expand_width ( )
498+ . lens ( FractalData :: probe_sampling. map (
499+ |val| * val as f64 ,
500+ |val, new| * val = new as i64 ) ) , 1.0 )
501+ . with_child ( Label :: < i64 > :: new ( |data : & i64 , _env : & _ | {
502+ format ! ( "{:>3}" , * data)
503+ } ) . lens ( FractalData :: probe_sampling) ) )
504+ . with_spacer ( 4.0 )
505+ . with_child ( create_checkbox_row ( "Jitter pixels" ) . lens ( FractalData :: jitter) )
484506 . with_spacer ( 4.0 )
485- . with_child ( create_label_textbox_row ( "GLITCH %:" , 120.0 ) . lens ( FractalData :: glitch_percentage) )
486507 . with_child ( Flex :: row ( )
487- . with_child ( Label :: new ( "Data Int.:" ) . fix_width ( 100.0 ) )
508+ . with_child ( Label :: new ( "Jitter spread:" ) )
509+ . with_flex_child ( Slider :: new ( )
510+ . with_range ( 0.0 , 1.0 )
511+ . expand_width ( )
512+ . lens ( FractalData :: jitter_factor. map (
513+ |val| * val,
514+ |val, new| * val = new) ) , 1.0 )
515+ . with_child ( Label :: < f64 > :: new ( |data : & f64 , _env : & _ | {
516+ format ! ( "{:>3.2}" , * data)
517+ } ) . lens ( FractalData :: jitter_factor) ) )
518+ . with_spacer ( 4.0 )
519+ . with_child ( Flex :: row ( )
520+ . with_child ( Label :: new ( "Data interval:" ) )
488521 . with_flex_child ( Slider :: new ( )
489522 . with_range ( 0.0 , 5.0 )
490523 . expand_width ( )
@@ -495,13 +528,9 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
495528 format ! ( "{:>6}" , * data)
496529 } ) . lens ( FractalData :: iteration_interval) ) )
497530 . with_spacer ( 4.0 )
498- . with_child ( create_label_textbox_row ( "PROBE SAMPLING:" , 100.0 ) . lens ( FractalData :: probe_sampling) )
499- . with_spacer ( 4.0 )
500- . with_child ( create_label_textbox_row ( "JITTER FACTOR:" , 100.0 ) . lens ( FractalData :: jitter_factor) ) ;
501-
502- let group_extra = Flex :: column ( )
503- . with_child ( button_save_advanced_options)
504- . with_child ( group_advanced_options) ;
531+ . with_child ( Button :: new ( "SET" ) . on_click ( |ctx, _data, _env| {
532+ ctx. submit_command ( SET_ADVANCED_OPTIONS ) ;
533+ } ) . expand_width ( ) . fix_height ( 40.0 ) ) ;
505534
506535 let tabs_menu = Either :: new ( |data : & FractalData , _env| data. current_tab )
507536 . add_branch ( Flex :: column ( )
@@ -510,7 +539,7 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
510539 . with_child ( group_palette)
511540 )
512541 . add_branch ( group_location)
513- . add_branch ( group_extra ) ;
542+ . add_branch ( group_advanced_options ) ;
514543
515544 let tabs_selector = Flex :: row ( )
516545 . with_flex_child ( Button :: from_label ( Label :: new ( "IMAGE" ) . with_text_size ( 16.0 ) ) . on_click ( |_ctx, data : & mut FractalData , _env| {
0 commit comments