mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-30 17:54:28 +02:00
better stopping on exploding nodes
This commit is contained in:
parent
79522a3560
commit
42c86d4f10
3 changed files with 18 additions and 307 deletions
168
build/bundle.js
168
build/bundle.js
|
@ -12932,7 +12932,12 @@ var VisNode = VisBase.extend({
|
||||||
cy: y
|
cy: y
|
||||||
});
|
});
|
||||||
// continuation calculation
|
// continuation calculation
|
||||||
return ((vx * vx + vy * vy) > 0.01) ? true : false;
|
if ((vx * vx + vy * vy) < 0.01 && Math.abs(y - maxHeight) === 0) {
|
||||||
|
// dont need to animate anymore, we are on ground
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// keep animating!
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
return stepFunc;
|
return stepFunc;
|
||||||
},
|
},
|
||||||
|
@ -16851,160 +16856,6 @@ exports.LeftRightView = LeftRightView;
|
||||||
});
|
});
|
||||||
require("/src/js/views/index.js");
|
require("/src/js/views/index.js");
|
||||||
|
|
||||||
require.define("/src/js/views/miscViews.js",function(require,module,exports,__dirname,__filename,process,global){var GitError = require('../util/errors').GitError;
|
|
||||||
var _ = require('underscore');
|
|
||||||
// horrible hack to get localStorage Backbone plugin
|
|
||||||
var Backbone = (!require('../util').isBrowser()) ? Backbone = require('backbone') : Backbone = window.Backbone;
|
|
||||||
|
|
||||||
var InteractiveRebaseView = Backbone.View.extend({
|
|
||||||
tagName: 'div',
|
|
||||||
template: _.template($('#interactive-rebase-template').html()),
|
|
||||||
|
|
||||||
events: {
|
|
||||||
'click #confirmButton': 'confirmed'
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(options) {
|
|
||||||
this.hasClicked = false;
|
|
||||||
this.deferred = options.deferred;
|
|
||||||
|
|
||||||
this.rebaseArray = options.toRebase;
|
|
||||||
|
|
||||||
this.rebaseEntries = new RebaseEntryCollection();
|
|
||||||
this.rebaseMap = {};
|
|
||||||
this.entryObjMap = {};
|
|
||||||
|
|
||||||
this.rebaseArray.reverse();
|
|
||||||
// make basic models for each commit
|
|
||||||
_.each(this.rebaseArray, function(commit) {
|
|
||||||
var id = commit.get('id');
|
|
||||||
this.rebaseMap[id] = commit;
|
|
||||||
this.entryObjMap[id] = new RebaseEntry({
|
|
||||||
id: id
|
|
||||||
});
|
|
||||||
this.rebaseEntries.add(this.entryObjMap[id]);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.render();
|
|
||||||
|
|
||||||
// show the dialog holder
|
|
||||||
this.show();
|
|
||||||
},
|
|
||||||
|
|
||||||
show: function() {
|
|
||||||
this.toggleVisibility(true);
|
|
||||||
},
|
|
||||||
|
|
||||||
hide: function() {
|
|
||||||
this.toggleVisibility(false);
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleVisibility: function(toggle) {
|
|
||||||
this.$el.toggleClass('shown', toggle);
|
|
||||||
},
|
|
||||||
|
|
||||||
confirmed: function() {
|
|
||||||
// we hide the dialog anyways, but they might be fast clickers
|
|
||||||
if (this.hasClicked) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.hasClicked = true;
|
|
||||||
|
|
||||||
// first of all hide
|
|
||||||
this.$('#iRebaseDialog').css('display', 'none');
|
|
||||||
this.hide();
|
|
||||||
|
|
||||||
// get our ordering
|
|
||||||
var uiOrder = [];
|
|
||||||
this.$('ul#rebaseEntries li').each(function(i, obj) {
|
|
||||||
uiOrder.push(obj.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
// now get the real array
|
|
||||||
var toRebase = [];
|
|
||||||
_.each(uiOrder, function(id) {
|
|
||||||
// the model
|
|
||||||
if (this.entryObjMap[id].get('pick')) {
|
|
||||||
toRebase.unshift(this.rebaseMap[id]);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.deferred.resolve(toRebase);
|
|
||||||
// garbage collection will get us
|
|
||||||
this.$el.html('');
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
var json = {
|
|
||||||
num: this.rebaseArray.length
|
|
||||||
};
|
|
||||||
|
|
||||||
this.$el.html(this.template(json));
|
|
||||||
|
|
||||||
// also render each entry
|
|
||||||
var listHolder = this.$('ul#rebaseEntries');
|
|
||||||
this.rebaseEntries.each(function(entry) {
|
|
||||||
new RebaseEntryView({
|
|
||||||
el: listHolder,
|
|
||||||
model: entry
|
|
||||||
});
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
// then make it reorderable..
|
|
||||||
listHolder.sortable({
|
|
||||||
distance: 5,
|
|
||||||
placeholder: 'ui-state-highlight'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var RebaseEntry = Backbone.Model.extend({
|
|
||||||
defaults: {
|
|
||||||
pick: true
|
|
||||||
},
|
|
||||||
|
|
||||||
toggle: function() {
|
|
||||||
this.set('pick', !this.get('pick'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var RebaseEntryCollection = Backbone.Collection.extend({
|
|
||||||
model: RebaseEntry
|
|
||||||
});
|
|
||||||
|
|
||||||
var RebaseEntryView = Backbone.View.extend({
|
|
||||||
tagName: 'li',
|
|
||||||
template: _.template($('#interactive-rebase-entry-template').html()),
|
|
||||||
|
|
||||||
toggle: function() {
|
|
||||||
this.model.toggle();
|
|
||||||
|
|
||||||
// toggle a class also
|
|
||||||
this.listEntry.toggleClass('notPicked', !this.model.get('pick'));
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(options) {
|
|
||||||
this.render();
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
var json = this.model.toJSON();
|
|
||||||
this.$el.append(this.template(this.model.toJSON()));
|
|
||||||
|
|
||||||
// hacky :( who would have known jquery barfs on ids with %'s and quotes
|
|
||||||
this.listEntry = this.$el.children(':last');
|
|
||||||
|
|
||||||
this.listEntry.delegate('#toggleButton', 'click', _.bind(function() {
|
|
||||||
this.toggle();
|
|
||||||
}, this));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exports.InteractiveRebaseView = InteractiveRebaseView;
|
|
||||||
|
|
||||||
});
|
|
||||||
require("/src/js/views/miscViews.js");
|
|
||||||
|
|
||||||
require.define("/src/js/views/rebaseView.js",function(require,module,exports,__dirname,__filename,process,global){var GitError = require('../util/errors').GitError;
|
require.define("/src/js/views/rebaseView.js",function(require,module,exports,__dirname,__filename,process,global){var GitError = require('../util/errors').GitError;
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
var Q = require('q');
|
var Q = require('q');
|
||||||
|
@ -19316,7 +19167,12 @@ var VisNode = VisBase.extend({
|
||||||
cy: y
|
cy: y
|
||||||
});
|
});
|
||||||
// continuation calculation
|
// continuation calculation
|
||||||
return ((vx * vx + vy * vy) > 0.01) ? true : false;
|
if ((vx * vx + vy * vy) < 0.01 && Math.abs(y - maxHeight) === 0) {
|
||||||
|
// dont need to animate anymore, we are on ground
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// keep animating!
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
return stepFunc;
|
return stepFunc;
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,150 +0,0 @@
|
||||||
var GitError = require('../util/errors').GitError;
|
|
||||||
var _ = require('underscore');
|
|
||||||
// horrible hack to get localStorage Backbone plugin
|
|
||||||
var Backbone = (!require('../util').isBrowser()) ? Backbone = require('backbone') : Backbone = window.Backbone;
|
|
||||||
|
|
||||||
var InteractiveRebaseView = Backbone.View.extend({
|
|
||||||
tagName: 'div',
|
|
||||||
template: _.template($('#interactive-rebase-template').html()),
|
|
||||||
|
|
||||||
events: {
|
|
||||||
'click #confirmButton': 'confirmed'
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(options) {
|
|
||||||
this.hasClicked = false;
|
|
||||||
this.deferred = options.deferred;
|
|
||||||
|
|
||||||
this.rebaseArray = options.toRebase;
|
|
||||||
|
|
||||||
this.rebaseEntries = new RebaseEntryCollection();
|
|
||||||
this.rebaseMap = {};
|
|
||||||
this.entryObjMap = {};
|
|
||||||
|
|
||||||
this.rebaseArray.reverse();
|
|
||||||
// make basic models for each commit
|
|
||||||
_.each(this.rebaseArray, function(commit) {
|
|
||||||
var id = commit.get('id');
|
|
||||||
this.rebaseMap[id] = commit;
|
|
||||||
this.entryObjMap[id] = new RebaseEntry({
|
|
||||||
id: id
|
|
||||||
});
|
|
||||||
this.rebaseEntries.add(this.entryObjMap[id]);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.render();
|
|
||||||
|
|
||||||
// show the dialog holder
|
|
||||||
this.show();
|
|
||||||
},
|
|
||||||
|
|
||||||
show: function() {
|
|
||||||
this.toggleVisibility(true);
|
|
||||||
},
|
|
||||||
|
|
||||||
hide: function() {
|
|
||||||
this.toggleVisibility(false);
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleVisibility: function(toggle) {
|
|
||||||
this.$el.toggleClass('shown', toggle);
|
|
||||||
},
|
|
||||||
|
|
||||||
confirmed: function() {
|
|
||||||
// we hide the dialog anyways, but they might be fast clickers
|
|
||||||
if (this.hasClicked) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.hasClicked = true;
|
|
||||||
|
|
||||||
// first of all hide
|
|
||||||
this.$('#iRebaseDialog').css('display', 'none');
|
|
||||||
this.hide();
|
|
||||||
|
|
||||||
// get our ordering
|
|
||||||
var uiOrder = [];
|
|
||||||
this.$('ul#rebaseEntries li').each(function(i, obj) {
|
|
||||||
uiOrder.push(obj.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
// now get the real array
|
|
||||||
var toRebase = [];
|
|
||||||
_.each(uiOrder, function(id) {
|
|
||||||
// the model
|
|
||||||
if (this.entryObjMap[id].get('pick')) {
|
|
||||||
toRebase.unshift(this.rebaseMap[id]);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.deferred.resolve(toRebase);
|
|
||||||
// garbage collection will get us
|
|
||||||
this.$el.html('');
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
var json = {
|
|
||||||
num: this.rebaseArray.length
|
|
||||||
};
|
|
||||||
|
|
||||||
this.$el.html(this.template(json));
|
|
||||||
|
|
||||||
// also render each entry
|
|
||||||
var listHolder = this.$('ul#rebaseEntries');
|
|
||||||
this.rebaseEntries.each(function(entry) {
|
|
||||||
new RebaseEntryView({
|
|
||||||
el: listHolder,
|
|
||||||
model: entry
|
|
||||||
});
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
// then make it reorderable..
|
|
||||||
listHolder.sortable({
|
|
||||||
distance: 5,
|
|
||||||
placeholder: 'ui-state-highlight'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var RebaseEntry = Backbone.Model.extend({
|
|
||||||
defaults: {
|
|
||||||
pick: true
|
|
||||||
},
|
|
||||||
|
|
||||||
toggle: function() {
|
|
||||||
this.set('pick', !this.get('pick'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var RebaseEntryCollection = Backbone.Collection.extend({
|
|
||||||
model: RebaseEntry
|
|
||||||
});
|
|
||||||
|
|
||||||
var RebaseEntryView = Backbone.View.extend({
|
|
||||||
tagName: 'li',
|
|
||||||
template: _.template($('#interactive-rebase-entry-template').html()),
|
|
||||||
|
|
||||||
toggle: function() {
|
|
||||||
this.model.toggle();
|
|
||||||
|
|
||||||
// toggle a class also
|
|
||||||
this.listEntry.toggleClass('notPicked', !this.model.get('pick'));
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(options) {
|
|
||||||
this.render();
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
var json = this.model.toJSON();
|
|
||||||
this.$el.append(this.template(this.model.toJSON()));
|
|
||||||
|
|
||||||
// hacky :( who would have known jquery barfs on ids with %'s and quotes
|
|
||||||
this.listEntry = this.$el.children(':last');
|
|
||||||
|
|
||||||
this.listEntry.delegate('#toggleButton', 'click', _.bind(function() {
|
|
||||||
this.toggle();
|
|
||||||
}, this));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exports.InteractiveRebaseView = InteractiveRebaseView;
|
|
|
@ -391,7 +391,12 @@ var VisNode = VisBase.extend({
|
||||||
cy: y
|
cy: y
|
||||||
});
|
});
|
||||||
// continuation calculation
|
// continuation calculation
|
||||||
return ((vx * vx + vy * vy) > 0.01) ? true : false;
|
if ((vx * vx + vy * vy) < 0.01 && Math.abs(y - maxHeight) === 0) {
|
||||||
|
// dont need to animate anymore, we are on ground
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// keep animating!
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
return stepFunc;
|
return stepFunc;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue