diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-11-03 18:50:43 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-11-04 12:46:53 +0300 |
commit | bfb664b65de2c71ee3d85760ee5dcf83a7c9aa23 (patch) | |
tree | 5fbf3a679eac84d38c35751e509a955fd36b0cdd /source | |
parent | 74ef424cb78c68b161a97ff6f5ebc100e8905dd4 (diff) |
Fix T92791: collapsed nodes scaling widget wrong with interface scale
Size, position and scale of the "two-line" widget (the one to scale a
node horizontally) was not taking interface scale into account. In the
case of the report, it could happen it draws behind an output socket.
before (at 2.0 interface scale)
{F11698493}
after (at 2.0 interface scale)
{F11698501}
Maniphest Tasks: T92791
Differential Revision: https://developer.blender.org/D13088
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_node/drawnode.cc | 2 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.cc | 20 |
2 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index a6ee7d1e5b6..fe866a81f67 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -254,7 +254,7 @@ static int node_resize_area_default(bNode *node, int x, int y) if (node->flag & NODE_HIDDEN) { rctf totr = node->totr; /* right part of node */ - totr.xmin = node->totr.xmax - 20.0f; + totr.xmin = node->totr.xmax - 1.0f * U.widget_unit; if (BLI_rctf_isect_pt(&totr, x, y)) { return NODE_RESIZE_RIGHT; } diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index f76c29ef0d9..b6c24a55a78 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -2015,25 +2015,27 @@ static void node_draw_hidden(const bContext *C, immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_TEXT, -40, -180); - float dx = 10.0f; + float dx = 0.5f * U.widget_unit; + const float dx2 = 0.15f * U.widget_unit * snode->runtime->aspect; + const float dy = 0.2f * U.widget_unit; immBegin(GPU_PRIM_LINES, 4); - immVertex2f(pos, rct->xmax - dx, centy - 4.0f); - immVertex2f(pos, rct->xmax - dx, centy + 4.0f); + immVertex2f(pos, rct->xmax - dx, centy - dy); + immVertex2f(pos, rct->xmax - dx, centy + dy); - immVertex2f(pos, rct->xmax - dx - 3.0f * snode->runtime->aspect, centy - 4.0f); - immVertex2f(pos, rct->xmax - dx - 3.0f * snode->runtime->aspect, centy + 4.0f); + immVertex2f(pos, rct->xmax - dx - dx2, centy - dy); + immVertex2f(pos, rct->xmax - dx - dx2, centy + dy); immEnd(); immUniformThemeColorShadeAlpha(TH_TEXT, 0, -180); dx -= snode->runtime->aspect; immBegin(GPU_PRIM_LINES, 4); - immVertex2f(pos, rct->xmax - dx, centy - 4.0f); - immVertex2f(pos, rct->xmax - dx, centy + 4.0f); + immVertex2f(pos, rct->xmax - dx, centy - dy); + immVertex2f(pos, rct->xmax - dx, centy + dy); - immVertex2f(pos, rct->xmax - dx - 3.0f * snode->runtime->aspect, centy - 4.0f); - immVertex2f(pos, rct->xmax - dx - 3.0f * snode->runtime->aspect, centy + 4.0f); + immVertex2f(pos, rct->xmax - dx - dx2, centy - dy); + immVertex2f(pos, rct->xmax - dx - dx2, centy + dy); immEnd(); immUnbindProgram(); |