@@ -180,10 +180,12 @@ ccui.ScrollView = ccui.Layout.extend(/** @lends ccui.ScrollView# */{
180180 * @param {cc.Size } size inner container size.
181181 */
182182 setInnerContainerSize : function ( size ) {
183- var innerContainer = this . _innerContainer ;
184- var locSize = this . _contentSize ;
185- var innerSizeWidth = locSize . width , innerSizeHeight = locSize . height ;
186- var originalInnerSize = innerContainer . getContentSize ( ) ;
183+ var innerContainer = this . _innerContainer ,
184+ locSize = this . _contentSize ,
185+ innerSizeWidth = locSize . width , innerSizeHeight = locSize . height ,
186+ originalInnerSize = innerContainer . getContentSize ( ) ,
187+ renderCmd = this . _renderCmd ,
188+ newInnerSize , offset ;
187189 if ( size . width < locSize . width )
188190 cc . log ( "Inner width <= ScrollView width, it will be force sized!" ) ;
189191 else
@@ -195,24 +197,29 @@ ccui.ScrollView = ccui.Layout.extend(/** @lends ccui.ScrollView# */{
195197 innerSizeHeight = size . height ;
196198
197199 innerContainer . setContentSize ( cc . size ( innerSizeWidth , innerSizeHeight ) ) ;
198- var newInnerSize , offset ;
199200 switch ( this . direction ) {
200201 case ccui . ScrollView . DIR_VERTICAL :
201202 newInnerSize = innerContainer . getContentSize ( ) ;
202203 offset = originalInnerSize . height - newInnerSize . height ;
204+ // Made child nodes transform available for scroll
205+ renderCmd . transform ( renderCmd . getParentRenderCmd ( ) , true ) ;
203206 this . _scrollChildren ( 0 , offset ) ;
204207 break ;
205208 case ccui . ScrollView . DIR_HORIZONTAL :
206209 if ( innerContainer . getRightBoundary ( ) <= locSize . width ) {
207210 newInnerSize = innerContainer . getContentSize ( ) ;
208211 offset = originalInnerSize . width - newInnerSize . width ;
212+ // Made child nodes transform available for scroll
213+ renderCmd . transform ( renderCmd . getParentRenderCmd ( ) , true ) ;
209214 this . _scrollChildren ( offset , 0 ) ;
210215 }
211216 break ;
212217 case ccui . ScrollView . DIR_BOTH :
213218 newInnerSize = innerContainer . getContentSize ( ) ;
214219 var offsetY = originalInnerSize . height - newInnerSize . height ;
215220 var offsetX = ( innerContainer . getRightBoundary ( ) <= locSize . width ) ? originalInnerSize . width - newInnerSize . width : 0 ;
221+ // Made child nodes transform available for scroll
222+ renderCmd . transform ( renderCmd . getParentRenderCmd ( ) , true ) ;
216223 this . _scrollChildren ( offsetX , offsetY ) ;
217224 break ;
218225 default :
@@ -326,9 +333,9 @@ ccui.ScrollView = ccui.Layout.extend(/** @lends ccui.ScrollView# */{
326333 } ,
327334
328335 updateChildren : function ( ) {
329- var child ;
336+ var child , i , l ;
330337 var childrenArray = this . _innerContainer . _children ;
331- for ( var i = 0 ; i < childrenArray . length ; i ++ ) {
338+ for ( i = 0 , l = childrenArray . length ; i < l ; i ++ ) {
332339 child = childrenArray [ i ] ;
333340 if ( child . _inViewRect === true && this . _isInContainer ( child ) === false )
334341 child . _inViewRect = false ;
0 commit comments