@@ -754,109 +754,8 @@ where
754754 . min_bounds ( )
755755 . width ;
756756
757- state. dimensions . byte_width = state. dimensions . char_width * 2.5 ;
758- state. dimensions . group_spacing = state. dimensions . char_width ;
759- state. dimensions . section_separator_spacing = state. dimensions . char_width * 2.0 ;
760-
761- state. dimensions . section_data_start = state. dimensions . char_width
762- * state. dimensions . address_char_len as f32
763- + state. dimensions . section_separator_spacing ;
764- state. dimensions . section_ascii_start = state. dimensions . section_data_start
765- + state. dimensions . byte_width * options. row_length as f32
766- + ( options. row_length as f32 / state. dimensions . group_char_len as f32 - 1.0 )
767- * state. dimensions . group_spacing
768- + state. dimensions . section_separator_spacing ;
769-
770- state. dimensions . address_separator_x =
771- state. dimensions . section_data_start - state. dimensions . section_separator_spacing / 2.0 ;
772- state. dimensions . ascii_separator_x =
773- state. dimensions . section_ascii_start - state. dimensions . section_separator_spacing / 2.0 ;
774- state. text . jumpto_len = state. text . jumpto_text . len ( ) as f32 * state. dimensions . char_width ;
775-
776- let options_text = "Options" ;
777- let options_width = options_text. len ( ) as f32 * state. dimensions . char_width ;
778- state. bounds . options = Rectangle {
779- x : limits. min ( ) . width ,
780- y : limits. max ( ) . height - state. dimensions . char_height * 1.5 ,
781- width : options_width,
782- height : state. dimensions . char_height * 1.5 ,
783- } ;
784-
785- let total_width = limits. max ( ) . width ;
786- let jumpto_x = ( total_width - state. text . jumpto_len - options_width) / 2.0 ;
787- let input_x = jumpto_x + state. text . jumpto_len + state. dimensions . char_width ;
788-
789- state. bounds . addr_input = Rectangle {
790- x : input_x,
791- y : limits. max ( ) . height - state. dimensions . char_height * 1.3 ,
792- width : ( state. dimensions . char_width + 1.0 )
793- * state. dimensions . address_char_len as f32
794- * 1.1 ,
795- height : state. dimensions . char_height * 1.1 ,
796- } ;
797-
798- let panel_bounds = Rectangle {
799- x : state. dimensions . char_width * 0.5 ,
800- y : limits. max ( ) . height
801- - state. dimensions . char_height * 1.5
802- - state. dimensions . char_height * 4.0 ,
803- width : limits. max ( ) . width - state. dimensions . char_width ,
804- height : state. dimensions . char_height * 4.0 ,
805- } ;
806-
807- let label_width = 120.0 ;
808- let offset_y = panel_bounds. y + state. dimensions . char_height * 0.5 ;
809- let checkbox_size = state. dimensions . char_height * 0.8 ;
810- let base_x = panel_bounds. x + state. dimensions . char_width + label_width;
811-
812- state. bounds . show_ascii_checkbox = Rectangle {
813- x : base_x + 3.0 * state. dimensions . char_width ,
814- y : offset_y + state. dimensions . char_height * 2.0 ,
815- width : checkbox_size,
816- height : checkbox_size,
817- } ;
818-
819- state. bounds . text_format = Rectangle {
820- x : base_x + 2.0 * state. dimensions . char_width ,
821- y : offset_y + state. dimensions . char_height ,
822- width : state. dimensions . char_width * 3.0 ,
823- height : state. dimensions . char_height ,
824- } ;
825-
826- state. bounds . prev_format = Rectangle {
827- x : base_x,
828- y : offset_y + state. dimensions . char_height ,
829- width : state. dimensions . char_width ,
830- height : state. dimensions . char_height ,
831- } ;
832-
833- state. bounds . next_format = Rectangle {
834- x : base_x + 6.0 * state. dimensions . char_width ,
835- y : offset_y + state. dimensions . char_height ,
836- width : state. dimensions . char_width ,
837- height : state. dimensions . char_height ,
838- } ;
839-
840- state. bounds . prev_row_length = Rectangle {
841- x : base_x,
842- y : offset_y,
843- width : state. dimensions . char_width ,
844- height : state. dimensions . char_height ,
845- } ;
846-
847- state. bounds . next_row_length = Rectangle {
848- x : base_x + 6.0 * state. dimensions . char_width ,
849- y : offset_y,
850- width : state. dimensions . char_width ,
851- height : state. dimensions . char_height ,
852- } ;
853-
854- state. bounds . text_row_length = Rectangle {
855- x : base_x + 2.0 * state. dimensions . char_width ,
856- y : offset_y,
857- width : state. dimensions . char_width * 3.0 ,
858- height : state. dimensions . char_height ,
859- } ;
757+ state. update_dimensions ( options. row_length as f32 ) ;
758+ state. update_bounds ( limits) ;
860759
861760 layout:: Node :: with_children ( limits. max ( ) , vec ! [ ] )
862761 }
@@ -1052,11 +951,11 @@ where
1052951 delta : mouse:: ScrollDelta :: Lines { y, .. } ,
1053952 } ) => {
1054953 let step = y. trunc ( ) * options. row_length as f32 ;
1055- if step. is_sign_negative ( ) {
1056- state. start_address = state . start_address . saturating_sub ( step. abs ( ) as usize ) ;
954+ state . start_address = if step. is_sign_negative ( ) {
955+ state. start_address . saturating_sub ( step. abs ( ) as usize )
1057956 } else {
1058- state. start_address += step as usize ;
1059- }
957+ state. start_address + step as usize
958+ } ;
1060959 publish ( self . data_update_message ( state, options. row_length ) ) ;
1061960 }
1062961 _ => ( ) ,
0 commit comments