diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2021-11-26 00:53:27 +0100 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2021-11-27 01:32:02 +0100 |
commit | cfacd9c057eb38ab0760374bd52905874b5b33ae (patch) | |
tree | d34bea4825c1bd6c54eccbdf034b0094db6252b5 /editor/plugins | |
parent | 2681d93b8a2f52eaae0f96c682f536704f2a7b78 (diff) |
Fix offset in Viewport drag movement
The initial offset was using the mouse position when the threshold
was reached instead of the initial click position. This was adding
the drag threshold distance as an extra offset to the final
transformation.
Now the offset is calculated from the initial click position.
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index a3378d1550..b6722b9d48 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2339,7 +2339,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { if (selection2.size() > 0) { drag_type = DRAG_MOVE; - drag_from = click; + drag_from = drag_start_origin; _save_canvas_item_state(drag_selection); } return true; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index d3b462cda5..0a8cfa3815 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -1749,7 +1749,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } else { const bool movement_threshold_passed = _edit.original_mouse_pos.distance_to(_edit.mouse_pos) > 8 * EDSCALE; if (clicked.is_valid() && movement_threshold_passed) { - _compute_edit(_edit.mouse_pos); + _compute_edit(_edit.original_mouse_pos); clicked = ObjectID(); _edit.mode = TRANSFORM_TRANSLATE; |