This commit improves the scaling of some ui widgets when
zooming by making the radius of the rounded corners
dependent on the element's zoom level.
The zoom is added as a parameter to the widget drawing functions
and can usually derived from the aspect. In the cases where that
isn't possible or wouldn't make sense we continue to rely on the
element's size.
The improvement is most noticeable in the node editor.
| master | patch |
|---|---|
Issue
Most UI widgets have a fixed corner radius based on the constant
U.widget_unit that is scaled by the roundness defined in the theme.
This means that, when the size of these widgets changes (e.g. when
zooming into nodes or scaling regions with ctrl + mousewheel) the
absolute corner radius in screen space stays the same, but changes
relatively to the element.
Approach
Instead of a constant corner radius, the corner rounding should be
scaled according to the zoom.
In most parts of the UI this won't make a difference.
The zoom is the inverse of the aspect but the term is more
clear even though aspect is used in many other places in
blender.
In principle this approach should work for all widgets but there are
some that don't have access to the aspect or have a special shape
(like the scrollbars) where basing it on U.widget_unit wouldn't
make sense. Those widgets are kept unchanged and calculate the
corner radius based on the size of the element, which works
with any zoom level.
Limitations
Currently popovers (with the triangle pointing at the button) stay
with a fixed corner radius, that doesn't adjust to the zoom.
Since those popovers exhibit some additional issues like the
triangle clipping on higher zoom levels I think I might address
them in a different patch.
Side Effects
I still have to check more areas of blender to see whether I missed
something, but so far I haven't found any unintended side effects.




