UI: Consistent Area Move Snapping Locations

Change Area Move snapping locations to even 12ths, rather than current
eights and thirds, so snap distances are consistent sizes. Also adds
snapping at minimum and maximum locations.

see D11938 for details and illustrations.

Differential Revision: https://developer.blender.org/D11938

Reviewed by Hans Goudey
This commit is contained in:
Harley Acheson
2021-08-26 10:51:30 -07:00
parent 8e5b7ac6e2
commit e5ed9991ea

View File

@@ -1738,19 +1738,19 @@ static int area_snap_calc_location(const bScreen *screen,
int snap_dist_best = INT_MAX;
{
const float div_array[] = {
/* Middle. */
1.0f / 2.0f,
/* Thirds. */
1.0f / 3.0f,
2.0f / 3.0f,
/* Quarters. */
1.0f / 4.0f,
3.0f / 4.0f,
/* Eighth. */
1.0f / 8.0f,
3.0f / 8.0f,
5.0f / 8.0f,
7.0f / 8.0f,
0.0f,
1.0f / 12.0f,
2.0f / 12.0f,
3.0f / 12.0f,
4.0f / 12.0f,
5.0f / 12.0f,
6.0f / 12.0f,
7.0f / 12.0f,
8.0f / 12.0f,
9.0f / 12.0f,
10.0f / 12.0f,
11.0f / 12.0f,
1.0f,
};
/* Test the snap to the best division. */
for (int i = 0; i < ARRAY_SIZE(div_array); i++) {