fn handle_input_change(rack: &mut T4edRack, errors: &mut ErrorDisplay, value: &str, scroll: bool) {
    match parse_usize(value) {
        Ok(seq) => {
            // Adjust the highet of the location display.
            let height = window().inner_height();
            set_max_height(&rack.columns, f64::from(height));

            // We only want to scroll when the user is typing in the input field, but not when the
            // user is selecting a cell visually.
            if scroll {
                scroll_to_element(&rack.columns);
            }

            errors.clear_error(RackError::NotANumber);
            if !rack.highlight_location(seq) {
                errors.add_error(RackError::OutOfRange(1, 160));
                rack.clear_rack_number();
                rack.deactivate_all();
            } else {
                errors.clear_error(RackError::OutOfRange(0, 0));
                if seq > 80 {
                    rack.set_rack_number(2);
                } else {
                    rack.set_rack_number(1);
                }
            }
        }
        Err(_) => {
            rack.clear_rack_number();
            errors.clear_error(RackError::OutOfRange(0, 0));
            rack.deactivate_all();
            // Empty input box.
            if value == "" {
                errors.clear_error(RackError::NotANumber);
            } else {
                errors.add_error(RackError::NotANumber);
            }
        }
    }
}
/// Fired when the highlighted cell should be updated.
Fired when the highlighted cell should be updated.
Fired when the highlighted cell should be updated .
fn handle_input_change(rack: &mut T4edRack, errors: &mut ErrorDisplay, value: &str, scroll: bool) {
    match parse_usize(value) {
        Ok(seq) => {
            // Adjust the highet of the location display.
            let height = window().inner_height();
            set_max_height(&rack.columns, f64::from(height));
            // We only want to scroll when the user is typing in the input field, but not when the
            // user is selecting a cell visually.
            if scroll {
                scroll_to_element(&rack.columns);
            }
            errors.clear_error(RackError::NotANumber);
            if !rack.highlight_location(seq) {
                errors.add_error(RackError::OutOfRange(1, 160));
                rack.clear_rack_number();
                rack.deactivate_all();
            } else {
                errors.clear_error(RackError::OutOfRange(0, 0));
                if seq > 80 {
                    rack.set_rack_number(2);
                } else {
                    rack.set_rack_number(1);
                }
            }
        }
        Err(_) => {
            rack.clear_rack_number();
            errors.clear_error(RackError::OutOfRange(0, 0));
            rack.deactivate_all();
            // Empty input box.
            if value == "" {
                errors.clear_error(RackError::NotANumber);
            } else {
                errors.add_error(RackError::NotANumber);
            }
        }
    }
}
fn handle_input_change ( rack : & mut T4edRack , errors : & mut ErrorDisplay , value : & str , scroll : bool ) { match parse_usize ( value ) { Ok ( seq ) => { // Adjust the highet of the location display. let height = window ( ) . inner_height ( ) ; set_max_height ( & rack . columns , f64 :: from ( height ) ) ; // We only want to scroll when the user is typing in the input field, but not when the // user is selecting a cell visually. if scroll { scroll_to_element ( & rack . columns ) ; } errors . clear_error ( RackError :: NotANumber ) ; if ! rack . highlight_location ( seq ) { errors . add_error ( RackError :: OutOfRange ( 1 , 160 ) ) ; rack . clear_rack_number ( ) ; rack . deactivate_all ( ) ; } else { errors . clear_error ( RackError :: OutOfRange ( 0 , 0 ) ) ; if seq > 80 { rack . set_rack_number ( 2 ) ; } else { rack . set_rack_number ( 1 ) ; } } } Err ( _ ) => { rack . clear_rack_number ( ) ; errors . clear_error ( RackError :: OutOfRange ( 0 , 0 ) ) ; rack . deactivate_all ( ) ; // Empty input box. if value == " " { errors . clear_error ( RackError :: NotANumber ) ; } else { errors . add_error ( RackError :: NotANumber ) ; } } } }
Fired when the highlighted cell should be updated.
Fired when the highlighted cell should be updated .
rack
&mut T4edRack
errors
&mut ErrorDisplay
value
&str
scroll
bool