mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-30 17:54:28 +02:00
got boudns working
This commit is contained in:
parent
7acde81510
commit
d825573ef9
4 changed files with 60 additions and 19 deletions
|
@ -10,13 +10,11 @@ var ConfirmCancelView = require('../views').ConfirmCancelView;
|
|||
var LeftRightView = require('../views').LeftRightView;
|
||||
var ModalAlert = require('../views').ModalAlert;
|
||||
|
||||
var NAV_EVENT_DELAY = 300;
|
||||
|
||||
var MultiView = Backbone.View.extend({
|
||||
tagName: 'div',
|
||||
className: 'multiView',
|
||||
// ms to debounce the nav functions
|
||||
navEventDelay: 1500,
|
||||
navEventDebounce: 150,
|
||||
|
||||
// a simple mapping of what childViews we support
|
||||
typeToConstructor: {
|
||||
|
@ -50,25 +48,34 @@ var MultiView = Backbone.View.extend({
|
|||
getPosFunc: function() {
|
||||
return _.debounce(_.bind(function() {
|
||||
this.navForward();
|
||||
}, this), NAV_EVENT_DELAY, true);
|
||||
}, this), this.navEventDebounce, true);
|
||||
},
|
||||
|
||||
getNegFunc: function() {
|
||||
return _.debounce(_.bind(function() {
|
||||
this.navBackward();
|
||||
}, this), NAV_EVENT_DELAY, true);
|
||||
}, this), this.navEventDebounce, true);
|
||||
},
|
||||
|
||||
navForward: function() {
|
||||
if (this.currentIndex === this.childViews.length - 1) {
|
||||
this.hideViewIndex(this.currentIndex);
|
||||
this.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
this.navIndexChange(1);
|
||||
},
|
||||
|
||||
navBackward: function() {
|
||||
if (this.currentIndex === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.navIndexChange(-1);
|
||||
},
|
||||
|
||||
navIndexChange: function(delta) {
|
||||
console.log('doing nav index change', delta);
|
||||
this.hideViewIndex(this.currentIndex);
|
||||
this.currentIndex += delta;
|
||||
this.showViewIndex(this.currentIndex);
|
||||
|
@ -82,6 +89,11 @@ var MultiView = Backbone.View.extend({
|
|||
this.childViews[index].show();
|
||||
},
|
||||
|
||||
finish: function() {
|
||||
// promise resolve??
|
||||
console.log('promise resolve :D');
|
||||
},
|
||||
|
||||
createChildView: function(viewJSON) {
|
||||
var type = viewJSON.type;
|
||||
if (!this.typeToConstructor[type]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue