Fix #134107: Snapping while resizing nodes not working
The grid size varied depending on the UI scale. This caused unintended behavior with snapping while resizing nodes. Pull Request: https://projects.blender.org/blender/blender/pulls/134123
This commit is contained in:
@@ -1016,10 +1016,12 @@ wmKeyMap *node_resize_modal_keymap(wmKeyConfig *keyconf)
|
||||
return keymap;
|
||||
}
|
||||
|
||||
/* Compute the nearest 1D coordinate corresponding to the nearest grid in node. */
|
||||
/* Compute the nearest 1D coordinate corresponding to the nearest grid in node editors. */
|
||||
static float nearest_node_grid_coord(float co)
|
||||
{
|
||||
float grid_size = grid_size_get();
|
||||
/* Size and location of nodes are independent of UI scale, so grid size should be independent of
|
||||
* UI scale as well. */
|
||||
float grid_size = grid_size_get() / UI_SCALE_FAC;
|
||||
float rest = fmod(co, grid_size);
|
||||
float offset = rest - grid_size / 2 >= 0 ? grid_size : 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user