]> git.tdb.fi Git - libs/gltk.git/commitdiff
Fix some alignment issues in LinearArrangement
authorMikko Rasa <tdb@tdb.fi>
Thu, 27 Jun 2013 13:37:19 +0000 (16:37 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 27 Jun 2013 13:37:19 +0000 (16:37 +0300)
source/lineararrangement.cpp
source/lineararrangement.h

index 9e6441afaa8c72a3cdad8720f56ca0103186b20d..5d18cfb309423bae9a99553264d9031f5ad965e5 100644 (file)
@@ -38,13 +38,13 @@ void LinearArrangement::process_widget(Widget &wdg, Side side, bool aligned)
 {
        if(side==opposite)
        {
-               bool snug = (edges[primary].aligned && aligned && !split_here);
+               bool snug = (internal_aligned && aligned && !split_here);
                add_constraint(wdg, get_order_constraint(primary, !snug), primary);
                if(first)
-                       edges[side].add(wdg, aligned);
+                       edges[side].add(wdg, (aligned && gravity==opposite));
        }
        else if(side==primary)
-               next.add(wdg, (aligned && gravity==primary));
+               next.add(wdg, aligned);
        else
        {
                if(edges[side].aligned && aligned)
@@ -55,6 +55,9 @@ void LinearArrangement::process_widget(Widget &wdg, Side side, bool aligned)
 
 void LinearArrangement::finish_slot()
 {
+       internal_aligned = next.aligned;
+       if(gravity!=primary)
+               next.aligned = false;
        edges[primary] = next;
        next.clear();
        split_here = false;
index 3fd5ef770623c2db2d5004ab9e5ffe6f245ba665..a18c849fcafacf210a5381e2e0ce90f98ca89e42 100644 (file)
@@ -26,6 +26,7 @@ protected:
        bool first;
        bool split_here;
        Side gravity;
+       bool internal_aligned;
 
        LinearArrangement(Layout &, Side);