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
This commit is contained in:
Philipp Oeser 2021-11-03 16:50:43 +01:00
parent 74ef424cb7
commit bfb664b65d
Notes: blender-bot 2023-02-14 06:17:17 +01:00
Referenced by issue #92791, Collapsed nodes are not scaling correctly.
2 changed files with 12 additions and 10 deletions

View File

@ -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;
}

View File

@ -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();