Merge pull request #1047 from zilongshanren/fix-scrollview-content-null-1.2

only register event when content is not null
This commit is contained in:
Jare Guo
2016-08-17 10:57:38 +08:00
committed by GitHub
+3 -1
View File
@@ -1339,7 +1339,9 @@ var ScrollView = cc.Class({
this._calculateBoundary();
//Because widget component will adjust content position and scrollview position is correct after visit
//So this event could make sure the content is on the correct position after loading.
cc.director.once(cc.Director.EVENT_AFTER_VISIT, this._adjustContentOutOfBoundary, this);
if(this.content) {
cc.director.once(cc.Director.EVENT_AFTER_VISIT, this._adjustContentOutOfBoundary, this);
}
},
onDestroy: function() {