fix scrollview content boundary

This commit is contained in:
zilongshanren
2016-03-29 18:27:53 +08:00
parent d81446c2cc
commit 719bcf9766
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) {