From 5247cce63f0ccee4002bed0541ebe925c46ea710 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 21 Dec 2012 19:44:57 +0000 Subject: Stack items on the same layer by x coordinate for a deterministic quasi-cascade look. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@4877 a436a847-0d15-0410-975c-d299462d15a1 --- src/group.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/group.c b/src/group.c index 2a12951..6e212a7 100644 --- a/src/group.c +++ b/src/group.c @@ -198,7 +198,14 @@ ganv_group_unmap(GanvItem* item) static gint item_layer_cmp(const void* a, const void* b, void* user_data) { - return ((GanvItem*)a)->layer - ((GanvItem*)b)->layer; + GanvItem* ia = (GanvItem*)a; + GanvItem* ib = (GanvItem*)b; + if (ia->layer == ib->layer) { + // Same layer, order in a quasi-cascade + return (ia->x - ib->x); + } else { + return ia->layer - ib->layer; + } } static void -- cgit v1.2.1