From b94447a298146f273c848541a3122afea001ba39 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 26 Oct 2021 12:33:36 +0200 Subject: Fix T92494: Node Editor dot grid not respecting display resolution scale This seems wrong and was especially noticeable since transform snapping does account for it (which was reported in T92494). Now divide the `DotGridLevelInfo` `step_factor` by the default of 20 for `U.widget_unit` and scale it later by the actual interface scale. note: when zooming, this will still always snap to the smallest dot level (not sure, with a bit more work it could be possible to only snap to the lowest visible level after fading?) Maniphest Tasks: T92494 Differential Revision: https://developer.blender.org/D13002 --- source/blender/editors/interface/view2d.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 3b6a7e1e88e..eea6512f0f8 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1324,15 +1324,15 @@ typedef struct DotGridLevelInfo { } DotGridLevelInfo; static const DotGridLevelInfo level_info[9] = { - {128.0f, -0.1f, 0.01f}, - {64.0f, 0.0f, 0.025f}, - {32.0f, 0.025f, 0.15f}, - {16.0f, 0.05f, 0.2f}, - {8.0f, 0.1f, 0.25f}, - {4.0f, 0.125f, 0.3f}, - {2.0f, 0.25f, 0.5f}, - {1.0f, 0.7f, 0.9f}, - {0.5f, 0.6f, 0.9f}, + {6.4f, -0.1f, 0.01f}, + {3.2f, 0.0f, 0.025f}, + {1.6f, 0.025f, 0.15f}, + {0.8f, 0.05f, 0.2f}, + {0.4f, 0.1f, 0.25f}, + {0.2f, 0.125f, 0.3f}, + {0.1f, 0.25f, 0.5f}, + {0.05f, 0.7f, 0.9f}, + {0.025f, 0.6f, 0.9f}, }; /** @@ -1363,7 +1363,7 @@ void UI_view2d_dot_grid_draw(const View2D *v2d, for (int level = 0; level < grid_levels; level++) { const DotGridLevelInfo *info = &level_info[level]; - const float step = min_step * info->step_factor; + const float step = min_step * info->step_factor * U.widget_unit; const float alpha_factor = (zoom_normalized - info->fade_in_start_zoom) / (info->fade_in_end_zoom - info->fade_in_start_zoom); -- cgit v1.2.3