diff --git a/src/input_map.rs b/src/input_map.rs index 4ee004f5..afcef5fe 100644 --- a/src/input_map.rs +++ b/src/input_map.rs @@ -323,23 +323,24 @@ impl InputMap { // Generate the raw action presses for (action, input_vec) in self.iter() { - let mut pressed = false; let mut action_datum = ActionData::default(); for input in input_vec { - action_datum.axis_pair = input_streams.input_axis_pair(input); + // Merge axis pair into action datum + if let Some(axis_pair) = input_streams.input_axis_pair(input) { + action_datum.axis_pair = action_datum + .axis_pair + .map_or(Some(axis_pair), |current_axis_pair| { + Some(current_axis_pair.merged_with(axis_pair)) + }); + } if input_streams.input_pressed(input) { - pressed = true; - + action_datum.state = ButtonState::JustPressed; action_datum.value += input_streams.input_value(input, true); } } - if pressed { - action_datum.state = ButtonState::JustPressed; - } - action_data.insert(action.clone(), action_datum); }