Procházet zdrojové kódy

added Sprite.getSize(), slightly different from getBounds(), make sure text bounds are always the same

ncannasse před 9 roky
rodič
revize
08e682d8c7
12 změnil soubory, kde provedl 112 přidání a 81 odebrání
  1. 2 2
      h2d/Anim.hx
  2. 2 2
      h2d/Bitmap.hx
  3. 13 31
      h2d/Flow.hx
  4. 2 2
      h2d/Graphics.hx
  5. 12 2
      h2d/HtmlText.hx
  6. 2 2
      h2d/Interactive.hx
  7. 2 2
      h2d/Mask.hx
  8. 2 2
      h2d/ScaleGrid.hx
  9. 27 4
      h2d/Sprite.hx
  10. 2 2
      h2d/SpriteBatch.hx
  11. 44 28
      h2d/Text.hx
  12. 2 2
      h2d/TileGroup.hx

+ 2 - 2
h2d/Anim.hx

@@ -33,8 +33,8 @@ class Anim extends Drawable {
 		return curFrame;
 		return curFrame;
 	}
 	}
 
 
-	override function getBoundsRec( relativeTo, out ) {
-		super.getBoundsRec(relativeTo, out);
+	override function getBoundsRec( relativeTo, out, forSize ) {
+		super.getBoundsRec(relativeTo, out, forSize);
 		var tile = getFrame();
 		var tile = getFrame();
 		if( tile != null ) addBounds(relativeTo, out, tile.dx, tile.dy, tile.width, tile.height);
 		if( tile != null ) addBounds(relativeTo, out, tile.dx, tile.dy, tile.width, tile.height);
 	}
 	}

+ 2 - 2
h2d/Bitmap.hx

@@ -15,8 +15,8 @@ class Bitmap extends Drawable {
 		return tileWrap = b;
 		return tileWrap = b;
 	}
 	}
 
 
-	override function getBoundsRec( relativeTo, out ) {
-		super.getBoundsRec(relativeTo, out);
+	override function getBoundsRec( relativeTo, out, forSize ) {
+		super.getBoundsRec(relativeTo, out, forSize);
 		if( tile != null ) addBounds(relativeTo, out, tile.dx, tile.dy, tile.width, tile.height);
 		if( tile != null ) addBounds(relativeTo, out, tile.dx, tile.dy, tile.width, tile.height);
 	}
 	}
 
 

+ 13 - 31
h2d/Flow.hx

@@ -52,16 +52,6 @@ class Flow extends Sprite {
 	public var maxWidth(default, set) : Null<Int>;
 	public var maxWidth(default, set) : Null<Int>;
 	public var maxHeight(default, set) : Null<Int>;
 	public var maxHeight(default, set) : Null<Int>;
 
 
-	/**
-		The calculated width based on the flow elements.
-	**/
-	public var calculatedWidth(get, null) = 0.;
-
-	/**
-		The calculated height based on the flow elements.
-	**/
-	public var calculatedHeight(get, null) = 0.;
-
 	/**
 	/**
 		Will set all padding values at the same time.
 		Will set all padding values at the same time.
 	**/
 	**/
@@ -109,15 +99,13 @@ class Flow extends Sprite {
 	var background : h2d.ScaleGrid;
 	var background : h2d.ScaleGrid;
 	var properties : Array<FlowProperties> = [];
 	var properties : Array<FlowProperties> = [];
 
 
+	var calculatedWidth : Float = 0.;
+	var calculatedHeight : Float = 0.;
+
 	public function new(?parent) {
 	public function new(?parent) {
 		super(parent);
 		super(parent);
 	}
 	}
 
 
-	override public function getBounds(?relativeTo:Sprite, ?out:h2d.col.Bounds):h2d.col.Bounds {
-		reflow();
-		return super.getBounds(relativeTo, out);
-	}
-
 	/**
 	/**
 		Get the per-element properties. Returns null if the element is not currently part of the flow.
 		Get the per-element properties. Returns null if the element is not currently part of the flow.
 	**/
 	**/
@@ -184,13 +172,13 @@ class Flow extends Sprite {
 		return paddingBottom = v;
 		return paddingBottom = v;
 	}
 	}
 
 
-	override function getBoundsRec( relativeTo, out ) {
-		super.getBoundsRec(relativeTo, out);
+	override function getBoundsRec( relativeTo, out, forSize ) {
 		if( needReflow ) reflow();
 		if( needReflow ) reflow();
-		var cw = calculatedWidth;
-		var ch = calculatedHeight;
-		if( cw != 0 || ch != 0 )
-			addBounds(relativeTo, out, 0, 0, cw, ch);
+		if( forSize ) {
+			if( calculatedWidth != 0 )
+				addBounds(relativeTo, out, 0, 0, calculatedWidth, calculatedHeight);
+		} else
+			super.getBoundsRec(relativeTo, out, forSize);
 	}
 	}
 
 
 	override function addChildAt( s, pos ) {
 	override function addChildAt( s, pos ) {
@@ -357,10 +345,7 @@ class Flow extends Sprite {
 
 
 				if( p.align == Absolute ) continue;
 				if( p.align == Absolute ) continue;
 
 
-				c.x = 0;
-				c.y = 0;
-				var b = c.getBounds(this, tmpBounds);
-
+				var b = c.getSize(tmpBounds);
 				p.calculatedWidth = b.xMax + p.paddingLeft + p.paddingRight;
 				p.calculatedWidth = b.xMax + p.paddingLeft + p.paddingRight;
 				p.calculatedHeight = b.yMax + p.paddingTop + p.paddingBottom;
 				p.calculatedHeight = b.yMax + p.paddingTop + p.paddingBottom;
 				if( p.minWidth != null && p.calculatedWidth < p.minWidth ) p.calculatedWidth = p.minWidth;
 				if( p.minWidth != null && p.calculatedWidth < p.minWidth ) p.calculatedWidth = p.minWidth;
@@ -417,12 +402,9 @@ class Flow extends Sprite {
 
 
 				if( p.align == Absolute ) continue;
 				if( p.align == Absolute ) continue;
 
 
-				c.x = 0;
-				c.y = 0;
-				var b = c.getBounds(this, tmpBounds);
-
-				p.calculatedWidth = b.xMax + p.paddingLeft + p.paddingRight;
-				p.calculatedHeight = b.yMax + p.paddingTop + p.paddingBottom;
+				var b = c.getSize(tmpBounds);
+				p.calculatedWidth = b.xMax - c.x + p.paddingLeft + p.paddingRight;
+				p.calculatedHeight = b.yMax - c.y + p.paddingTop + p.paddingBottom;
 				if( p.minWidth != null && p.calculatedWidth < p.minWidth ) p.calculatedWidth = p.minWidth;
 				if( p.minWidth != null && p.calculatedWidth < p.minWidth ) p.calculatedWidth = p.minWidth;
 				if( p.minHeight != null && p.calculatedHeight < p.minHeight ) p.calculatedHeight = p.minHeight;
 				if( p.minHeight != null && p.calculatedHeight < p.minHeight ) p.calculatedHeight = p.minHeight;
 
 

+ 2 - 2
h2d/Graphics.hx

@@ -148,8 +148,8 @@ class Graphics extends Drawable {
 		xMax = Math.NEGATIVE_INFINITY;
 		xMax = Math.NEGATIVE_INFINITY;
 	}
 	}
 
 
-	override function getBoundsRec( relativeTo, out ) {
-		super.getBoundsRec(relativeTo, out);
+	override function getBoundsRec( relativeTo, out, forSize ) {
+		super.getBoundsRec(relativeTo, out, forSize);
 		if( tile != null ) addBounds(relativeTo, out, xMin, yMin, xMax - xMin, yMax - yMin);
 		if( tile != null ) addBounds(relativeTo, out, xMin, yMin, xMax - xMin, yMax - yMin);
 	}
 	}
 
 

+ 12 - 2
h2d/HtmlText.hx

@@ -42,10 +42,16 @@ class HtmlText extends Text {
 		xPos = 0;
 		xPos = 0;
 		yPos = 0;
 		yPos = 0;
 		xMax = 0;
 		xMax = 0;
+		calcYMin = 0;
 		var doc = try Xml.parse(text) catch( e : Dynamic ) throw "Could not parse " + text + " (" + e +")";
 		var doc = try Xml.parse(text) catch( e : Dynamic ) throw "Could not parse " + text + " (" + e +")";
 		for( e in doc )
 		for( e in doc )
 			addNode(e, rebuild);
 			addNode(e, rebuild);
-		return cachedSize = { width : xPos > xMax ? xPos : xMax, height : xPos > 0 ? yPos + (font.lineHeight + lineSpacing) : yPos };
+
+		var x = xPos, y = yPos;
+		calcWidth = x > xMax ? x : xMax;
+		calcHeight = y > 0 && x == 0 ? y - lineSpacing : y + font.lineHeight;
+		calcSizeHeight = y > 0 && x == 0 ? y + (font.baseLine - font.lineHeight - lineSpacing) : y + font.baseLine;
+		calcDone = true;
 	}
 	}
 
 
 	function addNode( e : Xml, rebuild : Bool ) {
 	function addNode( e : Xml, rebuild : Bool ) {
@@ -74,10 +80,13 @@ class HtmlText extends Text {
 					xPos = 0;
 					xPos = 0;
 					yPos += font.lineHeight + lineSpacing;
 					yPos += font.lineHeight + lineSpacing;
 				}
 				}
+				var py = yPos + font.baseLine - i.height;
+				if( py + i.tile.dy < calcYMin )
+					calcYMin = py + i.tile.dy;
 				if( rebuild ) {
 				if( rebuild ) {
 					var b = new Bitmap(i, this);
 					var b = new Bitmap(i, this);
 					b.x = xPos;
 					b.x = xPos;
-					b.y = yPos + font.baseLine - i.height;
+					b.y = py;
 					images.push(b);
 					images.push(b);
 				}
 				}
 				xPos += i.width + letterSpacing;
 				xPos += i.width + letterSpacing;
@@ -102,6 +111,7 @@ class HtmlText extends Text {
 				var e = font.getChar(cc);
 				var e = font.getChar(cc);
 				xPos += e.getKerningOffset(prevChar);
 				xPos += e.getKerningOffset(prevChar);
 				if( rebuild ) glyphs.add(xPos, yPos, e.t);
 				if( rebuild ) glyphs.add(xPos, yPos, e.t);
+				if( yPos == 0 && e.t.dy < calcYMin ) calcYMin = e.t.dy;
 				xPos += e.width + letterSpacing;
 				xPos += e.width + letterSpacing;
 				prevChar = cc;
 				prevChar = cc;
 			}
 			}

+ 2 - 2
h2d/Interactive.hx

@@ -36,8 +36,8 @@ class Interactive extends Drawable {
 		if( backgroundColor != null ) emitTile(ctx, h2d.Tile.fromColor(backgroundColor, Std.int(width), Std.int(height), (backgroundColor>>>24)/255 ));
 		if( backgroundColor != null ) emitTile(ctx, h2d.Tile.fromColor(backgroundColor, Std.int(width), Std.int(height), (backgroundColor>>>24)/255 ));
 	}
 	}
 
 
-	override function getBoundsRec( relativeTo, out ) {
-		super.getBoundsRec(relativeTo, out);
+	override function getBoundsRec( relativeTo, out, forSize ) {
+		super.getBoundsRec(relativeTo, out, forSize);
 		if( backgroundColor != null ) addBounds(relativeTo, out, 0, 0, Std.int(width), Std.int(height));
 		if( backgroundColor != null ) addBounds(relativeTo, out, 0, 0, Std.int(width), Std.int(height));
 	}
 	}
 
 

+ 2 - 2
h2d/Mask.hx

@@ -11,8 +11,8 @@ class Mask extends Sprite {
 		this.height = height;
 		this.height = height;
 	}
 	}
 
 
-	override function getBoundsRec( relativeTo, out ) {
-		super.getBoundsRec(relativeTo, out);
+	override function getBoundsRec( relativeTo, out, forSize ) {
+		super.getBoundsRec(relativeTo, out, forSize);
 		var xMin = out.xMin, yMin = out.yMin, xMax = out.xMax, yMax = out.yMax;
 		var xMin = out.xMin, yMin = out.yMin, xMax = out.xMax, yMax = out.yMax;
 		out.empty();
 		out.empty();
 		addBounds(relativeTo, out, 0, 0, width, height);
 		addBounds(relativeTo, out, 0, 0, width, height);

+ 2 - 2
h2d/ScaleGrid.hx

@@ -37,9 +37,9 @@ class ScaleGrid extends h2d.TileGroup {
 		return h;
 		return h;
 	}
 	}
 
 
-	override function getBoundsRec(relativeTo, out) {
+	override function getBoundsRec(relativeTo, out, forSize) {
 		if( content.isEmpty() ) updateContent();
 		if( content.isEmpty() ) updateContent();
-		super.getBoundsRec(relativeTo, out);
+		super.getBoundsRec(relativeTo, out, forSize);
 	}
 	}
 
 
 	function updateContent() {
 	function updateContent() {

+ 27 - 4
h2d/Sprite.hx

@@ -43,13 +43,19 @@ class Sprite {
 			parent.addChild(this);
 			parent.addChild(this);
 	}
 	}
 
 
+	/**
+		Returns the bounds of the sprite for its whole content, recursively.
+		If relativeTo is null, it will return the bounds in the absolute coordinates.
+		If not, it will return the bounds relative to the specified sprite coordinates.
+		You can pass an already allocated bounds or getBounds will allocate one for you and return it.
+	**/
 	public function getBounds( ?relativeTo : Sprite, ?out : h2d.col.Bounds ) : h2d.col.Bounds {
 	public function getBounds( ?relativeTo : Sprite, ?out : h2d.col.Bounds ) : h2d.col.Bounds {
 		if( out == null ) out = new h2d.col.Bounds();
 		if( out == null ) out = new h2d.col.Bounds();
 		if( relativeTo != null )
 		if( relativeTo != null )
 			relativeTo.syncPos();
 			relativeTo.syncPos();
 		if( relativeTo != this )
 		if( relativeTo != this )
 			syncPos();
 			syncPos();
-		getBoundsRec(relativeTo, out);
+		getBoundsRec(relativeTo, out, false);
 		if( out.isEmpty() ) {
 		if( out.isEmpty() ) {
 			addBounds(relativeTo, out, -1, -1, 2, 2);
 			addBounds(relativeTo, out, -1, -1, 2, 2);
 			out.xMax = out.xMin = (out.xMax + out.xMin) * 0.5;
 			out.xMax = out.xMin = (out.xMax + out.xMin) * 0.5;
@@ -58,7 +64,24 @@ class Sprite {
 		return out;
 		return out;
 	}
 	}
 
 
-	function getBoundsRec( relativeTo : Sprite, out : h2d.col.Bounds ) {
+	/**
+		This is similar to getBounds(parent), but instead of the full content, it will return
+		the size based on the alignement of the Sprite. For instance for a text, getBounds will returns
+		the full glyphs size whereas getSize() will ignore the pixels under the baseline.
+	**/
+	public function getSize( ?out : h2d.col.Bounds ) : h2d.col.Bounds {
+		if( out == null ) out = new h2d.col.Bounds();
+		getBoundsRec(parent, out, true);
+		if( out.isEmpty() ) {
+			addBounds(parent, out, -1, -1, 2, 2);
+			out.xMax = out.xMin = (out.xMax + out.xMin) * 0.5;
+			out.yMax = out.yMin = (out.yMax + out.yMin) * 0.5;
+		}
+		out.offset( -x, -y);
+		return out;
+	}
+
+	function getBoundsRec( relativeTo : Sprite, out : h2d.col.Bounds, forSize : Bool ) {
 		if( posChanged ) {
 		if( posChanged ) {
 			calcAbsPos();
 			calcAbsPos();
 			for( c in childs )
 			for( c in childs )
@@ -72,14 +95,14 @@ class Sprite {
 		}
 		}
 		if( n == 1 ) {
 		if( n == 1 ) {
 			var c = childs[0];
 			var c = childs[0];
-			if( c.visible ) c.getBounds(relativeTo, out) else out.empty();
+			if( c.visible ) c.getBoundsRec(relativeTo, out,forSize) else out.empty();
 			return;
 			return;
 		}
 		}
 		var xmin = hxd.Math.POSITIVE_INFINITY, ymin = hxd.Math.POSITIVE_INFINITY;
 		var xmin = hxd.Math.POSITIVE_INFINITY, ymin = hxd.Math.POSITIVE_INFINITY;
 		var xmax = hxd.Math.NEGATIVE_INFINITY, ymax = hxd.Math.NEGATIVE_INFINITY;
 		var xmax = hxd.Math.NEGATIVE_INFINITY, ymax = hxd.Math.NEGATIVE_INFINITY;
 		for( c in childs ) {
 		for( c in childs ) {
 			if( !c.visible ) continue;
 			if( !c.visible ) continue;
-			c.getBoundsRec(relativeTo, out);
+			c.getBoundsRec(relativeTo, out, forSize);
 			if( out.xMin < xmin ) xmin = out.xMin;
 			if( out.xMin < xmin ) xmin = out.xMin;
 			if( out.yMin < ymin ) ymin = out.yMin;
 			if( out.yMin < ymin ) ymin = out.yMin;
 			if( out.xMax > xmax ) xmax = out.xMax;
 			if( out.xMax > xmax ) xmax = out.xMax;

+ 2 - 2
h2d/SpriteBatch.hx

@@ -138,8 +138,8 @@ class SpriteBatch extends Drawable {
 		}
 		}
 	}
 	}
 
 
-	override function getBoundsRec( relativeTo, out ) {
-		super.getBoundsRec(relativeTo, out);
+	override function getBoundsRec( relativeTo, out, forSize ) {
+		super.getBoundsRec(relativeTo, out, forSize);
 		var e = first;
 		var e = first;
 		while( e != null ) {
 		while( e != null ) {
 			var t = e.t;
 			var t = e.t;

+ 44 - 28
h2d/Text.hx

@@ -21,7 +21,12 @@ class Text extends Drawable {
 	public var lineSpacing(default,set) : Int;
 	public var lineSpacing(default,set) : Int;
 
 
 	var glyphs : TileGroup;
 	var glyphs : TileGroup;
-	var cachedSize : { width : Int, height : Int };
+
+	var calcDone:Bool;
+	var calcYMin:Int;
+	var calcWidth:Int;
+	var calcHeight:Int;
+	var calcSizeHeight:Int;
 
 
 	public function new( font : Font, ?parent ) {
 	public function new( font : Font, ?parent ) {
 		super(parent);
 		super(parent);
@@ -102,15 +107,25 @@ class Text extends Drawable {
 	}
 	}
 
 
 	function rebuild() {
 	function rebuild() {
-		cachedSize = null;
+		calcDone = false;
 		if( allocated && text != null && font != null ) initGlyphs(text);
 		if( allocated && text != null && font != null ) initGlyphs(text);
 	}
 	}
 
 
 	public function calcTextWidth( text : String ) {
 	public function calcTextWidth( text : String ) {
-		var old = cachedSize;
-		var w = initGlyphs(text,false).width;
-		cachedSize = old;
-		return w;
+		if( calcDone ) {
+			var ow = calcWidth, oh = calcHeight, osh = calcSizeHeight, oy = calcYMin;
+			initGlyphs(text, false);
+			var w = calcWidth;
+			calcWidth = ow;
+			calcHeight = oh;
+			calcSizeHeight = osh;
+			calcYMin = oy;
+			return w;
+		} else {
+			initGlyphs(text, false);
+			calcDone = false;
+			return calcWidth;
+		}
 	}
 	}
 
 
 	public function splitText( text : String, leftMargin = 0 ) {
 	public function splitText( text : String, leftMargin = 0 ) {
@@ -164,15 +179,15 @@ class Text extends Drawable {
 		return lines.join("\n");
 		return lines.join("\n");
 	}
 	}
 
 
-	function initGlyphs( text : String, rebuild = true, lines : Array<Int> = null ) : { width : Int, height : Int } {
+	function initGlyphs( text : String, rebuild = true, lines : Array<Int> = null ) : Void {
 		if( rebuild ) glyphs.clear();
 		if( rebuild ) glyphs.clear();
 		var x = 0, y = 0, xMax = 0, prevChar = -1;
 		var x = 0, y = 0, xMax = 0, prevChar = -1;
 		var align = rebuild ? textAlign : Left;
 		var align = rebuild ? textAlign : Left;
 		switch( align ) {
 		switch( align ) {
 		case Center, Right:
 		case Center, Right:
 			lines = [];
 			lines = [];
-			var inf = initGlyphs(text, false, lines);
-			var max = maxWidth == null ? inf.width : Std.int(maxWidth);
+			initGlyphs(text, false, lines);
+			var max = maxWidth == null ? calcWidth : Std.int(maxWidth);
 			var k = align == Center ? 1 : 0;
 			var k = align == Center ? 1 : 0;
 			for( i in 0...lines.length )
 			for( i in 0...lines.length )
 				lines[i] = (max - lines[i]) >> k;
 				lines[i] = (max - lines[i]) >> k;
@@ -181,6 +196,7 @@ class Text extends Drawable {
 		}
 		}
 		var dl = font.lineHeight + lineSpacing;
 		var dl = font.lineHeight + lineSpacing;
 		var calcLines = !rebuild && lines != null;
 		var calcLines = !rebuild && lines != null;
+		var yMin = 0;
 		for( i in 0...text.length ) {
 		for( i in 0...text.length ) {
 			var cc = text.charCodeAt(i);
 			var cc = text.charCodeAt(i);
 			var e = font.getChar(cc);
 			var e = font.getChar(cc);
@@ -205,6 +221,7 @@ class Text extends Drawable {
 			}
 			}
 			if( e != null ) {
 			if( e != null ) {
 				if( rebuild ) glyphs.add(x, y, e.t);
 				if( rebuild ) glyphs.add(x, y, e.t);
+				if( y == 0 && e.t.dy < yMin ) yMin = e.t.dy;
 				x += esize + letterSpacing;
 				x += esize + letterSpacing;
 			}
 			}
 			if( newline ) {
 			if( newline ) {
@@ -225,17 +242,26 @@ class Text extends Drawable {
 				prevChar = cc;
 				prevChar = cc;
 		}
 		}
 		if( calcLines ) lines.push(x);
 		if( calcLines ) lines.push(x);
-		return cachedSize = { width : x > xMax ? x : xMax, height : x > 0 ? y + dl : y > 0 ? y : dl };
+
+		calcYMin = yMin;
+		calcWidth = x > xMax ? x : xMax;
+		calcHeight = y > 0 && x == 0 ? y - lineSpacing : y + font.lineHeight;
+		calcSizeHeight = y > 0 && x == 0 ? y + (font.baseLine - dl) : y + font.baseLine;
+		calcDone = true;
+	}
+
+	inline function updateSize() {
+		if( !calcDone ) initGlyphs(text, false);
 	}
 	}
 
 
 	function get_textHeight() {
 	function get_textHeight() {
-		if( cachedSize != null ) return cachedSize.height;
-		return initGlyphs(text,false).height;
+		updateSize();
+		return calcHeight;
 	}
 	}
 
 
 	function get_textWidth() {
 	function get_textWidth() {
-		if( cachedSize != null ) return cachedSize.width;
-		return initGlyphs(text,false).width;
+		updateSize();
+		return calcWidth;
 	}
 	}
 
 
 	function set_maxWidth(w) {
 	function set_maxWidth(w) {
@@ -254,20 +280,10 @@ class Text extends Drawable {
 		return c;
 		return c;
 	}
 	}
 
 
-	override function getBoundsRec( relativeTo : Sprite, out : h2d.col.Bounds ) {
-		if( !allocated ) {
-			// if not on scene, the text is not yet built !
-			super.getBoundsRec(relativeTo, out);
-			var size = cachedSize == null ? initGlyphs(text, false) : cachedSize;
-			addBounds(relativeTo, out, 0, 0, size.width, size.height);
-		} else {
-			if( glyphs != null ) glyphs.visible = true;
-			super.getBoundsRec(relativeTo, out);
-			if( glyphs != null )
-				glyphs.visible = false;
-			else
-				addBounds(relativeTo, out, 0, 0, 16, 16);
-		}
+	override function getBoundsRec( relativeTo : Sprite, out : h2d.col.Bounds, forSize : Bool ) {
+		super.getBoundsRec(relativeTo, out, forSize);
+		updateSize();
+		addBounds(relativeTo, out, 0, forSize ? 0 : calcYMin, calcWidth, forSize ? calcSizeHeight : calcHeight - calcYMin);
 	}
 	}
 
 
 }
 }

+ 2 - 2
h2d/TileGroup.hx

@@ -326,8 +326,8 @@ class TileGroup extends Drawable {
 		content = new TileLayerContent();
 		content = new TileLayerContent();
 	}
 	}
 
 
-	override function getBoundsRec( relativeTo, out ) {
-		super.getBoundsRec(relativeTo, out);
+	override function getBoundsRec( relativeTo, out, forSize ) {
+		super.getBoundsRec(relativeTo, out, forSize);
 		addBounds(relativeTo, out, content.xMin, content.yMin, content.xMax - content.xMin, content.yMax - content.yMin);
 		addBounds(relativeTo, out, content.xMin, content.yMin, content.xMax - content.xMin, content.yMax - content.yMin);
 	}
 	}