@@ -858,7 +858,7 @@ void Input::warp_mouse(const Vector2 &p_position) {
858858 warp_mouse_func (p_position);
859859}
860860
861- Point2i Input::warp_mouse_motion (const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) {
861+ Point2 Input::warp_mouse_motion (const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) {
862862 // The relative distance reported for the next event after a warp is in the boundaries of the
863863 // size of the rect on that axis, but it may be greater, in which case there's no problem as fmod()
864864 // will warp it, but if the pointer has moved in the opposite direction between the pointer relocation
@@ -868,14 +868,14 @@ Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, con
868868 // detect the warp: if the relative distance is greater than the half of the size of the relevant rect
869869 // (checked per each axis), it will be considered as the consequence of a former pointer warp.
870870
871- const Point2i rel_sign (p_motion->get_relative ().x >= 0 .0f ? 1 : -1 , p_motion->get_relative ().y >= 0.0 ? 1 : -1 );
872- const Size2i warp_margin = p_rect.size * 0 .5f ;
873- const Point2i rel_warped (
871+ const Point2 rel_sign (p_motion->get_relative ().x >= 0 .0f ? 1 : -1 , p_motion->get_relative ().y >= 0.0 ? 1 : -1 );
872+ const Size2 warp_margin = p_rect.size * 0 .5f ;
873+ const Point2 rel_warped (
874874 Math::fmod (p_motion->get_relative ().x + rel_sign.x * warp_margin.x , p_rect.size .x ) - rel_sign.x * warp_margin.x ,
875875 Math::fmod (p_motion->get_relative ().y + rel_sign.y * warp_margin.y , p_rect.size .y ) - rel_sign.y * warp_margin.y );
876876
877- const Point2i pos_local = p_motion->get_global_position () - p_rect.position ;
878- const Point2i pos_warped (Math::fposmod (pos_local.x , p_rect.size .x ), Math::fposmod (pos_local.y , p_rect.size .y ));
877+ const Point2 pos_local = p_motion->get_global_position () - p_rect.position ;
878+ const Point2 pos_warped (Math::fposmod (pos_local.x , p_rect.size .x ), Math::fposmod (pos_local.y , p_rect.size .y ));
879879 if (pos_warped != pos_local) {
880880 warp_mouse (pos_warped + p_rect.position );
881881 }
0 commit comments