Revision: 1058
Author: allain.lalonde
Date: Tue Aug 31 06:08:47 2010
Log: Making getFullBounds invoke layoutChildren when provided.
http://code.google.com/p/piccolo2d/source/detail?r=1058
Modified:
/piccolo2d.js/trunk/piccolo2d.js
/piccolo2d.js/trunk/test.html
=======================================
--- /piccolo2d.js/trunk/piccolo2d.js Fri Aug 27 13:54:17 2010
+++ /piccolo2d.js/trunk/piccolo2d.js Tue Aug 31 06:08:47 2010
@@ -417,6 +417,10 @@
getFullBounds: function () {
if (!this.fullBounds) {
+ if (this.layoutChildren) {
+ this.layoutChildren();
+ }
+
this.fullBounds = new PBounds(this.bounds);
var child, childFullBounds, tBounds;
=======================================
--- /piccolo2d.js/trunk/test.html Thu Aug 26 12:57:21 2010
+++ /piccolo2d.js/trunk/test.html Tue Aug 31 06:08:47 2010
@@ -452,6 +452,19 @@
n.addListener(l);
equal(n.listeners.length, 1);
});
+
+ test("Children are layed out when computing fullBounds",
function() {
+ var layoutChildrenCalled = false;
+ var TestLayoutNode = PNode.extend({
+ layoutChildren: function() {
+ layoutChildrenCalled = true;
+ }
+ });
+
+ var testNode = new TestLayoutNode();
+ testNode.getFullBounds();
+ ok(layoutChildrenCalled, "layoutChildren was not called");
+ });
}
function testPRoot() {
--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en