Merge pull request #558 from zilongshanren/fix-scrollview-content-boundary

fix scrollview content boundary
This commit is contained in:
Jare Guo
2016-03-30 14:36:10 +08:00
2 changed files with 21 additions and 2 deletions
+11
View File
@@ -306,6 +306,17 @@ var Label = cc.Class({
if (!cc.sys.isNative) {
this._sgNode.on('load', this._updateNodeSize, this);
}
},
onEnable: function() {
this._super();
cc.director.on(cc.Director.EVENT_BEFORE_VISIT, this._updateNodeSize, this);
},
onDisable: function() {
this._super();
cc.director.off(cc.Director.EVENT_BEFORE_VISIT, this._updateNodeSize, this);
},
_createSgNode: function () {
+10 -2
View File
@@ -1025,11 +1025,19 @@ var ScrollView = cc.Class({
onLoad: function () {
if (!CC_EDITOR) {
this._registerEvent();
if(cc.isValid(this.content)) {
this.content.on('size-changed', this._calculateBoundary, this);
}
this.node.on('size-changed', this._calculateBoundary, this);
this._calculateBoundary();
}
},
start: function() {
this._calculateBoundary();
onDestroy: function() {
if(cc.isValid(this.content)) {
this.content.off('size-changed', this._calculateBoundary, this);
}
this.node.off('size-changed', this._calculateBoundary, this);
},
update: function(dt) {