From 0c57d8ad41415bab02599831f3c08b1797e47783 Mon Sep 17 00:00:00 2001 From: Mark Marijnissen Date: Mon, 14 Jul 2014 23:09:18 +0200 Subject: [PATCH] Added getSize() to FlexibleLayout Unlike for example SequentialLayout, FlexibleLayout did not have a getSize() method. This causes trouble when using a FlexibleLayout in a Scrollview or another FlexibleLayout. --- FlexibleLayout.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/FlexibleLayout.js b/FlexibleLayout.js index 46c1c91..18dc536 100644 --- a/FlexibleLayout.js +++ b/FlexibleLayout.js @@ -34,6 +34,8 @@ define(function(require, exports, module) { this._ratios = new Transitionable(this.options.ratios); this._nodes = []; + + this._size = [undefined,undefined]; // for getSize; this._cachedDirection = null; this._cachedTotalLength = false; @@ -148,6 +150,16 @@ define(function(require, exports, module) { this._ratiosDirty = true; }; + + /** + * Get size + * + * @method getSize + */ + FlexibleLayout.prototype.getSize = function getSize() { + return this._size; + }; + /** * Apply changes from this component to the corresponding document element. * This includes changes to classes, styles, size, content, opacity, origin, @@ -158,7 +170,7 @@ define(function(require, exports, module) { * @param {Context} context commit context */ FlexibleLayout.prototype.commit = function commit(context) { - var parentSize = context.size; + var parentSize = this._size = context.size; var parentTransform = context.transform; var parentOrigin = context.origin;