summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-12-21 19:44:57 +0000
committerDavid Robillard <d@drobilla.net>2012-12-21 19:44:57 +0000
commit5247cce63f0ccee4002bed0541ebe925c46ea710 (patch)
tree61e9149718a9b18135d2eca4781534a814185722
parent9306840a17b29faa3dccb614dfe27a15fa0250c8 (diff)
downloadganv-5247cce63f0ccee4002bed0541ebe925c46ea710.tar.gz
ganv-5247cce63f0ccee4002bed0541ebe925c46ea710.tar.bz2
ganv-5247cce63f0ccee4002bed0541ebe925c46ea710.zip
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
-rw-r--r--src/group.c9
1 files changed, 8 insertions, 1 deletions
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