Browse files

added offset option to PackableView

  • Loading branch information...
1 parent 97dec8c commit 305c6128fdaa21e2c841ea92620c205541e7d214 @michaelforrest committed Sep 23, 2011
Showing with 7 additions and 5 deletions.
  1. +7 −5 tidy/mvc/view/PackableView.as
View
12 tidy/mvc/view/PackableView.as
@@ -43,10 +43,10 @@ package tidy.mvc.view {
}
super.setOptions(options);
}
-
- public function append(element : DisplayObject) : DisplayObject {
+
+ public function append(element : DisplayObject, options:Object = null) : DisplayObject {
if(!element.parent) addChild(element);
- placeElement(element);
+ placeElement(element,options);
elements.add(element);
return element;
}
@@ -60,22 +60,24 @@ package tidy.mvc.view {
return elements;
}
- protected function placeElement(element : DisplayObject) : void {
+ protected function placeElement(element : DisplayObject,options:Object = null) : void {
+ var offset : Number = options && !isNaN(options.offset) ? options.offset : 0;
if(orientation == VERTICAL){
if(maxHeight && nextY + element.height > maxHeight) {
nextY = paddingTop;
nextX += columnWidth + spacing;
}
+ nextY += offset;
moveElement(element,nextX,nextY);
nextY += element.height + spacing;
-// trace("object", this,unique_id, "y=", element.y,"element.height=",element.height,"nextY",nextY);
}else{
maxRowHeight = Math.max(maxRowHeight, element.height);
if(maxWidth && nextX + element.width > maxWidth) {
nextY += maxRowHeight + spacing;
nextX = paddingLeft;
maxRowHeight = 0;
}
+ nextX += offset;
moveElement(element,nextX,nextY);
nextX = element.x + element.width + spacing;
}

0 comments on commit 305c612

Please sign in to comment.