You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2014/11/30 11:17:39 UTC

git commit: [flex-tlf] [refs/heads/develop] - Better handling of inserting table rows with merged cells.

Repository: flex-tlf
Updated Branches:
  refs/heads/develop 47ea3543e -> 1e0722fa2


Better handling of inserting table rows with merged cells.


Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/1e0722fa
Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/1e0722fa
Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/1e0722fa

Branch: refs/heads/develop
Commit: 1e0722fa2e254399074408cb04b94c163fc37d01
Parents: 47ea354
Author: Harbs <ha...@in-tools.com>
Authored: Sun Nov 30 12:17:30 2014 +0200
Committer: Harbs <ha...@in-tools.com>
Committed: Sun Nov 30 12:17:30 2014 +0200

----------------------------------------------------------------------
 .../flashx/textLayout/elements/TableElement.as  | 23 ++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/1e0722fa/textLayout/src/flashx/textLayout/elements/TableElement.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/elements/TableElement.as b/textLayout/src/flashx/textLayout/elements/TableElement.as
index beba4e7..6f230c0 100644
--- a/textLayout/src/flashx/textLayout/elements/TableElement.as
+++ b/textLayout/src/flashx/textLayout/elements/TableElement.as
@@ -517,7 +517,6 @@ package flashx.textLayout.elements
 			row.composedHeight = row.computedFormat.minCellHeight;
 			row.isMaxHeight = row.computedFormat.minCellHeight == row.computedFormat.maxCellHeight;
 
-			var blockedCoords:Vector.<CellCoords> = getBlockedCoords(idx);
 			var cellIdx:int = getCellIndex(idx,0);
 			if(cellIdx < 0)
 				cellIdx = numChildren;
@@ -526,20 +525,26 @@ package flashx.textLayout.elements
 			
 			if (cells==null) cells = [];
 			
-			// create more cells 
-			while(cells.length < numColumns){
+			var cell:TableCellElement;
+			// create more cells while tracking occupied columns of merged cells
+			var occupiedColumns:int = 0;
+			for each(cell in cells)
+				occupiedColumns += cell.columnSpan;
+
+			while(occupiedColumns < numColumns)
+			{
 				cells.push(new TableCellElement());
+				occupiedColumns++;
 			}
 			
-			for each(var cell:TableCellElement in cells){
-				while(blockedCoords.length && blockedCoords[0].column == colIdx){
-					colIdx++;
-					blockedCoords.shift();
-				}
-				if(colIdx < numColumns){
+			for each(cell in cells)
+			{
+				if(colIdx < numColumns)
+				{
 					addChildAt(cellIdx++,cell);
 					cell.damage();
 				}
+				colIdx += (cell.columnSpan-1);
 			}
 			return true;
 		}