Commit da2481a4 authored by Nikita Churaev's avatar Nikita Churaev
Browse files

Clean up icon distribution code.

* Renamed "nautilus_mix" to simply "mix".

* Fixed a silly math error (taking the cube root of 0.9 and then cubing
  it right back).

* Clarify what kind of jitter is being prevented by subtracting 1.0
  from the grid width.
parent d7977a9e
Pipeline #6004 passed with stage
in 4 minutes and 14 seconds
......@@ -109,7 +109,7 @@
#define UNDEFINED_TIME ((time_t) (-1))
static double
nautilus_mix (double x, double y, double fraction)
mix (double x, double y, double fraction)
{
return x * (1.0 - fraction) + y * fraction;
}
......@@ -1274,12 +1274,14 @@ lay_down_icons_horizontal (NautilusCanvasContainer *container,
double num_icons = MAX (1.0, g_list_length (icons));
double grid_width_for_num_icons = available_width / num_icons;
double used_fraction = MAX (0.0, MIN (1.0, (num_icons * min_grid_width) / available_width));
double mix_fraction = pow(used_fraction * pow(0.9, 1.0 / 3.0), 3.0) + 0.1;
double mix_fraction = pow(used_fraction, 3.0) * 0.9 + 0.1;
grid_width = nautilus_mix (min_grid_width, grid_width_for_num_icons, mix_fraction);
grid_width = mix (min_grid_width, grid_width_for_num_icons, mix_fraction);
}
/* Subtracting 1.0 prevents the jitter. */
/* Subtracting 1.0 prevents the jitter due to the code not being able to
* decide how many columns should be there (this fix is adapted from Nemo).
*/
grid_width = MAX (min_grid_width, floor (grid_width) - 1.0);
line_width = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment