diff --git a/platform/web/display_server_web.cpp b/platform/web/display_server_web.cpp index 40de4e523b0..87473ccec4c 100644 --- a/platform/web/display_server_web.cpp +++ b/platform/web/display_server_web.cpp @@ -673,7 +673,7 @@ void DisplayServerWeb::_touch_callback(int p_type, int p_count) { ev->set_index(touch_event.identifier[i]); ev->set_position(point); - Point2 &prev = ds->touches[i]; + Point2 &prev = ds->touches[touch_event.identifier[i]]; ev->set_relative(ev->get_position() - prev); ev->set_relative_screen_position(ev->get_relative()); prev = ev->get_position(); @@ -690,7 +690,12 @@ void DisplayServerWeb::_touch_callback(int p_type, int p_count) { ev->set_index(touch_event.identifier[i]); ev->set_position(point); ev->set_pressed(p_type == 0); - ds->touches[i] = point; + + if (p_type == 0) { + ds->touches[touch_event.identifier[i]] = point; + } else { + ds->touches.erase(touch_event.identifier[i]); + } Input::get_singleton()->parse_input_event(ev); diff --git a/platform/web/display_server_web.h b/platform/web/display_server_web.h index 352b3fe523d..b66bf1d700e 100644 --- a/platform/web/display_server_web.h +++ b/platform/web/display_server_web.h @@ -71,7 +71,7 @@ private: Callable drop_files_callback; String clipboard; - Point2 touches[32]; + HashMap touches; Array voices;