From df40440d22390a86c59e0e9fcc0db5dcfaa8cc11 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 2 Sep 2022 16:43:12 -0500 Subject: Cleanup: Avoid using node socket location The location of a reroute node and its sockets should be the same, only stored in different coordinate spaces. Because the node's location is the ground truth, use that for finding whether the mouse is hovering. --- source/blender/editors/space_node/node_select.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/space_node/node_select.cc b/source/blender/editors/space_node/node_select.cc index 29a809b8053..8cc3c80fdfd 100644 --- a/source/blender/editors/space_node/node_select.cc +++ b/source/blender/editors/space_node/node_select.cc @@ -141,14 +141,11 @@ static bNode *node_under_mouse_select(bNodeTree &ntree, const float2 mouse) static bool node_under_mouse_tweak(const bNodeTree &ntree, const float2 &mouse) { - using namespace blender::math; - LISTBASE_FOREACH_BACKWARD (const bNode *, node, &ntree.nodes) { switch (node->type) { case NODE_REROUTE: { - bNodeSocket *socket = (bNodeSocket *)node->inputs.first; - const float2 location{socket->locx, socket->locy}; - if (distance(mouse, location) < 24.0f) { + const float2 location = node_to_view(*node, {node->locx, node->locy}); + if (math::distance(mouse, location) < 24.0f) { return true; } break; -- cgit v1.2.3