Add screen-related attributes to mouse input events

This commit is contained in:
Markus Sauermann
2023-10-04 19:20:01 +02:00
parent d3352813ea
commit 2235a1cbd0
15 changed files with 146 additions and 5 deletions

View File

@@ -328,7 +328,9 @@ void DisplayServerWeb::_mouse_move_callback(double p_x, double p_y, double p_rel
ev->set_global_position(pos);
ev->set_relative(Vector2(p_rel_x, p_rel_y));
ev->set_relative_screen_position(ev->get_relative());
ev->set_velocity(Input::get_singleton()->get_last_mouse_velocity());
ev->set_screen_velocity(ev->get_velocity());
Input::get_singleton()->parse_input_event(ev);
}
@@ -707,6 +709,7 @@ void DisplayServerWeb::_touch_callback(int p_type, int p_count) {
Point2 &prev = ds->touches[i];
ev->set_relative(ev->get_position() - prev);
ev->set_relative_screen_position(ev->get_relative());
prev = ev->get_position();
Input::get_singleton()->parse_input_event(ev);