UI: TreeView Hierarchy Line with Region Zoom #117420

Merged
Harley Acheson merged 4 commits from Harley/blender:TreeViewLines into main 2024-01-23 20:39:24 +01:00
1 changed files with 3 additions and 3 deletions
Showing only changes of commit 4fdc63f0c3 - Show all commits

View File

@ -164,9 +164,9 @@ void AbstractTreeView::draw_hierarchy_lines_recursive(const ARegion &region,
/* Small vertical padding. */
const short line_padding = UI_UNIT_Y / 4.0f / aspect;
const float x = first_child_rect.xmin +
((first_descendant->indent_width() - (6.0f * UI_SCALE_FAC)) / aspect);
const float x = first_child_rect.xmin + ((first_descendant->indent_width() -
(0.5f * UI_ICON_SIZE) + U.pixelsize + UI_SCALE_FAC) /
Harley marked this conversation as resolved Outdated

Why is this not using UI_ICON_SIZE anymore? Now the position seems rather arbitrary, before it was more clear that it's centered horizontally under the icon. In general such arbitrary factors should be avoided since they say nothing, positioning should be based on known/named dimensions so intended visual relations are clear in code.

Why is this not using `UI_ICON_SIZE` anymore? Now the position seems rather arbitrary, before it was more clear that it's centered horizontally under the icon. In general such arbitrary factors should be avoided since they say nothing, positioning should be based on known/named dimensions so intended visual relations are clear in code.

No worries, changed to be based on half the icon width and line width nudges.

No worries, changed to be based on half the icon width and line width nudges.
aspect);
immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, x, first_child_rect.ymax - line_padding);
immVertex2f(pos, x, last_child_rect.ymin + line_padding);