mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
fix scrollview content boundary
This commit is contained in:
@@ -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 () {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user