Merge pull request #2086 from knoxHuang/v1.7

fix pageview bug for fireball/issues/6557
This commit is contained in:
Jare Guo
2017-10-31 21:05:08 +08:00
committed by GitHub
+7 -5
View File
@@ -417,11 +417,6 @@ var PageView = cc.Class({
_updatePageView: function () {
var pageCount = this._pages.length;
// 当页面数组变化时修改 content 大小
var layout = this.content.getComponent(cc.Layout);
if(layout && layout.enabled) {
layout.updateLayout();
}
if (this._curPageIdx >= pageCount) {
this._curPageIdx = pageCount === 0 ? 0 : pageCount - 1;
this._lastPageIdx = this._curPageIdx;
@@ -436,6 +431,13 @@ var PageView = cc.Class({
this._scrollCenterOffsetY[i] = Math.abs(this.content.y + this._pages[i].y);
}
}
// 当页面数组变化时修改 content 大小
var layout = this.content.getComponent(cc.Layout);
if (layout && layout.enabled) {
layout.updateLayout();
}
// 刷新 indicator 信息与状态
if (this.indicator) {
this.indicator._refresh();