diff options
author | António Fernandes <antoniof@gnome.org> | 2022-08-10 12:14:00 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-09-01 12:23:06 +0100 |
commit | bf2b63569dffb5738514e471281e926ab1684790 (patch) | |
tree | 771f23aeb85f5f0bcd73591d7c065aac9ff19c0c /src/nautilus-dnd.c | |
parent | b0636ee2fa839f5f4c3403e55ac730ba7a6b1920 (diff) | |
download | nautilus-bf2b63569dffb5738514e471281e926ab1684790.tar.gz |
dnd: Make it easier to identify pile of dragged thumbnails
Offset each picture 6 pixels in either direction.
Also have a stronger shadow, with same alpha as shadows in the view.
Diffstat (limited to 'src/nautilus-dnd.c')
-rw-r--r-- | src/nautilus-dnd.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c index 131493c5d..7df392037 100644 --- a/src/nautilus-dnd.c +++ b/src/nautilus-dnd.c @@ -231,11 +231,12 @@ get_paintable_for_drag_selection (GList *selection, GdkPaintable *icon; guint n_icons; guint icon_size = NAUTILUS_DRAG_SURFACE_ICON_SIZE; + float dx; float dy; /* A wide shadow for the pile of icons gives a sense of floating. */ GskShadow stack_shadow = {.color = {0, 0, 0, .alpha = 0.15}, .dx = 0, .dy = 2, .radius = 10 }; /* A slight shadow swhich makes each icon in the stack look separate. */ - GskShadow icon_shadow = {.color = {0, 0, 0, .alpha = 0.20}, .dx = 0, .dy = 1, .radius = 1 }; + GskShadow icon_shadow = {.color = {0, 0, 0, .alpha = 0.30}, .dx = 0, .dy = 1, .radius = 1 }; g_return_val_if_fail (NAUTILUS_IS_FILE (selection->data), NULL); @@ -268,6 +269,7 @@ get_paintable_for_drag_selection (GList *selection, * '--------' '--------' */ n_icons = g_queue_get_length (icons); + dx = (n_icons % 2 == 1) ? 6 : -6; dy = (n_icons == 2) ? 10 : (n_icons == 3) ? 6 : (n_icons >= 4) ? 4 : 0; /* We want the first icon on top of every other. So we need to start drawing @@ -276,7 +278,7 @@ get_paintable_for_drag_selection (GList *selection, * Also, add 10px horizontal offset, for shadow, to workaround this GTK bug: * https://gitlab.gnome.org/GNOME/gtk/-/issues/2341 */ - gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (10, dy * n_icons)); + gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (10 + (dx / 2), dy * n_icons)); gtk_snapshot_push_shadow (snapshot, &stack_shadow, 1); for (GList *l = g_queue_peek_tail_link (icons); l != NULL; l = l->prev) { @@ -286,7 +288,10 @@ get_paintable_for_drag_selection (GList *selection, float x = floor ((icon_size - w) / 2); float y = floor ((icon_size - h) / 2); - gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (0, -dy)); + gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (-dx, -dy)); + + /* Alternate horizontal offset direction to give a rough pile look. */ + dx = -dx; gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y)); gtk_snapshot_push_shadow (snapshot, &icon_shadow, 1); |