diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2022-01-05 14:32:00 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-02-08 12:14:14 +0300 |
commit | 1995aae6e3bf3c51b3945d6d31b4ad20fd11fb73 (patch) | |
tree | 3a28028ab3ae1896a00cfe80ba4fd3b4baec8669 /source/blender/editors/space_node/drawnode.cc | |
parent | b76918717dbfd8363f4cf114619861dac0110e52 (diff) |
Fix T94415: Nodes: poor selection behavior inside frame nodes
Previously, node selection made no distinction between a frame node and
other nodes. So a frame node would be selected by their whole rect or
center (depending on box/lasso/circle select). As a consequence of this,
box and lasso could not pratically be started inside a frame node (with
the intention to select a subset of contained child nodes) because the
frame would be selected immediately and tweak-transforming started.
Circle selecting would always contain the frame node as well (making
transforming a subset of nodes without also transforming the whole frame
impossible).
Now change selection behavior so that for all selection modes only the
border [the margin area that is automatically added around all nodes,
see note below] of a frame node is considered in selection. This makes
for a much more intuitive experience when arranging nodes inside frames.
note: to make the area of interest for selection/moving more obvious,
the cursor changes when hovering over (as is done for resizing).
note: this also makes the resize margin consistent with other nodes.
note: this also fixes right resize border (was exclusive instead of
inclusive as every other border)
Also fixes T46540.
Diffstat (limited to 'source/blender/editors/space_node/drawnode.cc')
-rw-r--r-- | source/blender/editors/space_node/drawnode.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 94da7d55e5d..30f2cc970bd 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -231,7 +231,6 @@ static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt NodeResizeDirection node_get_resize_direction(const bNode *node, const int x, const int y) { if (node->type == NODE_FRAME) { - const float size = 10.0f; NodeFrame *data = (NodeFrame *)node->storage; /* shrinking frame size is determined by child nodes */ @@ -242,7 +241,9 @@ NodeResizeDirection node_get_resize_direction(const bNode *node, const int x, co NodeResizeDirection dir = NODE_RESIZE_NONE; const rctf &totr = node->totr; - if (x >= totr.xmax - size && x < totr.xmax && y >= totr.ymin && y < totr.ymax) { + const float size = NODE_RESIZE_MARGIN; + + if (x > totr.xmax - size && x <= totr.xmax && y >= totr.ymin && y < totr.ymax) { dir |= NODE_RESIZE_RIGHT; } if (x >= totr.xmin && x < totr.xmin + size && y >= totr.ymin && y < totr.ymax) { |