Skip to content

Commit 160ae0b

Browse files
committed
Fix ScrollView initWithViewSize issue
1 parent d70597b commit 160ae0b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

extensions/gui/scrollview/CCScrollView.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)