@@ -936,13 +936,15 @@ fn input_event_from_value(
936936 // the minimum and maximum values for that axis depending on the
937937 // axis direction. This is typically done for DPad button input that
938938 // needs to be translated to an ABS_HAT axis input.
939- if axis_info. is_some ( ) && axis_direction. is_some ( ) {
940- let info = axis_info. unwrap ( ) ;
941- let direction = axis_direction. unwrap ( ) ;
942- match direction {
943- AxisDirection :: None => Some ( value) ,
944- AxisDirection :: Positive => Some ( info. maximum ( ) * value) ,
945- AxisDirection :: Negative => Some ( info. minimum ( ) * value) ,
939+ if let Some ( info) = axis_info {
940+ if let Some ( direction) = axis_direction {
941+ match direction {
942+ AxisDirection :: None => Some ( value) ,
943+ AxisDirection :: Positive => Some ( info. maximum ( ) * value) ,
944+ AxisDirection :: Negative => Some ( info. minimum ( ) * value) ,
945+ }
946+ } else {
947+ Some ( value)
946948 }
947949 } else {
948950 Some ( value)
@@ -971,8 +973,8 @@ fn input_event_from_value(
971973 // Cannot denormalize value without axis info
972974 EventType :: ABSOLUTE => None ,
973975 EventType :: RELATIVE => match RelativeAxisCode ( code) {
974- RelativeAxisCode :: REL_X => Some ( x? as i32 ) ,
975- RelativeAxisCode :: REL_Y => Some ( y? as i32 ) ,
976+ RelativeAxisCode :: REL_X => x . map ( |v| v as i32 ) ,
977+ RelativeAxisCode :: REL_Y => y . map ( |v| v as i32 ) ,
976978 _ => None ,
977979 } ,
978980 _ => None ,
0 commit comments