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.
This commit is contained in:
parent
cd10fb4826
commit
df40440d22
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue