changeset 39:04d2867d335c

Fix possible incorrect extra space after the last control in a layout.
author Jordan Miner <jminer7@gmail.com>
date Wed, 29 Jul 2009 23:27:41 -0500
parents 69df5369c5f7
children 735223842a85
files dynamin/gui/layout.d
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dynamin/gui/layout.d	Wed Jul 29 23:25:29 2009 -0500
+++ b/dynamin/gui/layout.d	Wed Jul 29 23:27:41 2009 -0500
@@ -273,6 +273,7 @@
 		real max = 0;
 		LayoutGroup* l;
 
+		bool prevNonFiller = false;
 		int sp = 0;
 		for(int col = 0; col < numColumns; ++col) { // go down each column
 			for(int row = 0; row < numRows; ++row) {
@@ -288,11 +289,14 @@
 				info.elasticWidth += max;
 			else if(colsInfo[col].elastic == Elasticity.Semi)
 				info.semiColumns++;
+			// this won't add spacing to the first non-filler
+			sp = (!colsInfo[col].filler && prevNonFiller) ? spacing : 0;
 			info.bestSize.width = info.bestSize.width + sp + max;
-			sp = (colsInfo[col].filler ? 0 : spacing);
+			prevNonFiller = !colsInfo[col].filler ? true : prevNonFiller ;
 			max = 0;
 		}
 
+		prevNonFiller = false;
 		real maxBl = 0;
 		sp = 0;
 		for(int row = 0; row < numRows; ++row) { // go over each row
@@ -311,8 +315,10 @@
 				info.elasticHeight += max;
 			else if(rowsInfo[row].elastic == Elasticity.Semi)
 				info.semiRows++;
+			// this won't add spacing to the first non-filler
+			sp = (!rowsInfo[row].filler && prevNonFiller) ? spacing : 0;
 			info.bestSize.height = info.bestSize.height + sp + max;
-			sp = (rowsInfo[row].filler ? 0 : spacing);
+			prevNonFiller = !rowsInfo[row].filler ? true : prevNonFiller ;
 			max = maxBl = 0;
 		}
 	}