更新ScrolView的例子,添加滑动事件

This commit is contained in:
leo
2018-06-06 10:36:49 +08:00
parent 7462d276db
commit 6e3552b7d1
32 changed files with 218 additions and 21847 deletions

View File

@@ -23,21 +23,24 @@ cc.Class({
this.grid.node.active = false;
var node = this.node.getChildByName(customData);
switch (node.name) {
case 'horizontal': {
this.horizontal.node.active = true;
this.onAddItem(this.horizontal, this.item);
break;
}
case 'vertical': {
this.vertical.node.active = true;
this.onAddItem(this.vertical, this.item);
break;
}
case 'grid': {
this.grid.node.active = true;
this.onAddItem(this.grid, this.item);
break;
}
case 'horizontal':
{
this.horizontal.node.active = true;
this.onAddItem(this.horizontal, this.item);
break;
}
case 'vertical':
{
this.vertical.node.active = true;
this.onAddItem(this.vertical, this.item);
break;
}
case 'grid':
{
this.grid.node.active = true;
this.onAddItem(this.grid, this.item);
break;
}
}
},
@@ -48,8 +51,17 @@ cc.Class({
contentNode.addChild(child);
},
onEventScrollView(event, eventType) {
console.log('eventType=', eventType, cc.ScrollView.EventType);
//当滑动到最后,添加一个
if (cc.ScrollView.EventType.AUTOSCROLL_ENDED_WITH_THRESHOLD == eventType) {
console.log('aa');
this.onAddItem(this.vertical, this.item);
}
},
// called every frame
update: function (dt) {
},
});
});