Add support for event accumlation (off by default, on for editor), fixes #26536
This commit is contained in:
@ -657,8 +657,35 @@ void InputDefault::set_mouse_in_window(bool p_in_window) {
|
||||
*/
|
||||
}
|
||||
|
||||
void InputDefault::accumulate_input_event(const Ref<InputEvent> &p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
if (!use_accumulated_input) {
|
||||
parse_input_event(p_event);
|
||||
return;
|
||||
}
|
||||
if (!accumulated_events.empty() && accumulated_events.back()->get()->accumulate(p_event)) {
|
||||
return; //event was accumulated, exit
|
||||
}
|
||||
|
||||
accumulated_events.push_back(p_event);
|
||||
}
|
||||
void InputDefault::flush_accumulated_events() {
|
||||
|
||||
while (accumulated_events.front()) {
|
||||
parse_input_event(accumulated_events.front()->get());
|
||||
accumulated_events.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
void InputDefault::set_use_accumulated_input(bool p_enable) {
|
||||
|
||||
use_accumulated_input = p_enable;
|
||||
}
|
||||
|
||||
InputDefault::InputDefault() {
|
||||
|
||||
use_accumulated_input = false;
|
||||
mouse_button_mask = 0;
|
||||
emulate_touch_from_mouse = false;
|
||||
emulate_mouse_from_touch = false;
|
||||
|
||||
Reference in New Issue
Block a user