Merge pull request #107933 from Nikitf777/Fix-point-jumping-when-dragging

Fix points jumping when dragging starts in the Polygon2D editor
This commit is contained in:
Rémi Verschelde 2025-06-28 13:03:05 +02:00
commit a9cef6cf69
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -629,9 +629,8 @@ void Polygon2DEditor::_canvas_input(const Ref<InputEvent> &p_input) {
if (current_action == ACTION_EDIT_POINT) {
point_drag_index = -1;
for (int i = 0; i < editing_points.size(); i++) {
Vector2 tuv = mtx.xform(editing_points[i]);
if (tuv.distance_to(mb->get_position()) < 8) {
drag_from = tuv;
if (mtx.xform(editing_points[i]).distance_to(mb->get_position()) < 8) {
drag_from = mb->get_position();
point_drag_index = i;
}
}