File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
extensions/gui/scrollview Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -140,14 +140,12 @@ cc.ScrollView = cc.Layer.extend(/** @lends cc.ScrollView# */{
140140 initWithViewSize :function ( size , container ) {
141141 var pZero = cc . p ( 0 , 0 ) ;
142142 if ( cc . Layer . prototype . init . call ( this ) ) {
143- this . _container = container ;
144-
145- if ( ! this . _container ) {
146- this . _container = new cc . Layer ( ) ;
147- this . _container . ignoreAnchorPointForPosition ( false ) ;
148- this . _container . setAnchorPoint ( pZero ) ;
143+ if ( ! container && ! this . _container ) {
144+ container = new cc . Layer ( ) ;
145+ }
146+ if ( container ) {
147+ this . setContainer ( container ) ;
149148 }
150-
151149 this . setViewSize ( size ) ;
152150
153151 this . setTouchEnabled ( true ) ;
@@ -161,7 +159,6 @@ cc.ScrollView = cc.Layer.extend(/** @lends cc.ScrollView# */{
161159 this . _container . setPosition ( pZero ) ;
162160 this . _touchLength = 0.0 ;
163161
164- this . addChild ( this . _container ) ;
165162 this . _minScale = this . _maxScale = 1.0 ;
166163 return true ;
167164 }
You can’t perform that action at this time.
0 commit comments