Merge pull request #25294 from groud/fix_2D_selection

Fixes Node2D selection not adapting to editor zoom level
This commit is contained in:
Rémi Verschelde 2019-01-24 23:38:30 +01:00 committed by GitHub
commit 6e65c73f71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -474,7 +474,7 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no
if (canvas_item && canvas_item->is_visible_in_tree()) { if (canvas_item && canvas_item->is_visible_in_tree()) {
Transform2D xform = (p_parent_xform * p_canvas_xform * canvas_item->get_transform()).affine_inverse(); Transform2D xform = (p_parent_xform * p_canvas_xform * canvas_item->get_transform()).affine_inverse();
const real_t local_grab_distance = xform.basis_xform(Vector2(grab_distance, 0)).length(); const real_t local_grab_distance = xform.basis_xform(Vector2(grab_distance, 0)).length() / zoom;
if (canvas_item->_edit_is_selected_on_click(xform.xform(p_pos), local_grab_distance)) { if (canvas_item->_edit_is_selected_on_click(xform.xform(p_pos), local_grab_distance)) {
Node2D *node = Object::cast_to<Node2D>(canvas_item); Node2D *node = Object::cast_to<Node2D>(canvas_item);