Fix positioning. Makes find_new_empty_spot tighter. Patch from Jimmy Do

2004-11-29  Alexander Larsson  <alexl@redhat.com>

	* libnautilus-private/nautilus-icon-container.c:
	(canvas_position_to_grid_position):
	Fix positioning. Makes find_new_empty_spot tighter.
	Patch from Jimmy Do <crispyleaves@gmail.com>
This commit is contained in:
Alexander Larsson 2004-11-29 14:15:41 +00:00 committed by Alexander Larsson
parent 51157244a6
commit 490a9fe90f
2 changed files with 11 additions and 7 deletions

View file

@ -1,3 +1,10 @@
2004-11-29 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-container.c:
(canvas_position_to_grid_position):
Fix positioning. Makes find_new_empty_spot tighter.
Patch from Jimmy Do <crispyleaves@gmail.com>
2004-11-29 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-container.c: (snap_position),

View file

@ -1265,23 +1265,20 @@ canvas_position_to_grid_position (PlacementGrid *grid,
ArtIRect canvas_position,
ArtIRect *grid_position)
{
/* The first bit of this block will identify all intersections
* that the icon actually crosses. The second bit will mark
* any intersections that the icon is adjacent to.
* The first causes minimal moving around during a snap, but
/* The first causes minimal moving around during a snap, but
* can end up with partially overlapping icons. The second one won't
* allow any overlapping, but can cause more movement to happen
* during a snap. */
if (grid->tight) {
grid_position->x0 = ceil ((double)(canvas_position.x0 - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X);
grid_position->y0 = ceil ((double)(canvas_position.y0 - DESKTOP_PAD_VERTICAL) / SNAP_SIZE_Y);
grid_position->x1 = floor ((double)(canvas_position.x1 - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X);
grid_position->x1 = floor ((double)(canvas_position.x1 - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X);
grid_position->y1 = floor ((double)(canvas_position.y1 - DESKTOP_PAD_VERTICAL) / SNAP_SIZE_Y);
} else {
grid_position->x0 = floor ((double)(canvas_position.x0 - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X);
grid_position->y0 = floor ((double)(canvas_position.y0 - DESKTOP_PAD_VERTICAL) / SNAP_SIZE_Y);
grid_position->x1 = ceil ((double)(canvas_position.x1 - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X);
grid_position->y1 = ceil ((double)(canvas_position.y1 - DESKTOP_PAD_VERTICAL) / SNAP_SIZE_Y);
grid_position->x1 = floor ((double)(canvas_position.x1 - DESKTOP_PAD_HORIZONTAL) / SNAP_SIZE_X);
grid_position->y1 = floor ((double)(canvas_position.y1 - DESKTOP_PAD_VERTICAL) / SNAP_SIZE_Y);
}
grid_position->x0 = CLAMP (grid_position->x0, 0, grid->num_columns - 1);