rollup stuff

This commit is contained in:
Peter Cottle 2012-11-03 11:53:25 -07:00
parent 866749bad5
commit 44322298ba
4 changed files with 35 additions and 3 deletions

2
README
View file

@ -5,4 +5,6 @@ Hi
Nikita Kouevda
Maksim Ioffe
Dan Miller

View file

@ -150,6 +150,13 @@ var Command = Backbone.Model.extend({
throw new CommandResult({
msg: "Refreshing tree..."
});
}],
[/^rollup (\d+)$/, function(bits) {
// go roll up these commands by joining them with semicolons
events.trigger('rollupCommands', bits[1]);
throw new CommandResult({
msg: 'Commands combined!'
});
}]
];
},
@ -164,8 +171,9 @@ var Command = Backbone.Model.extend({
// then check if it's one of our sandbox commands
_.each(this.getSandboxCommands(), function(tuple) {
var regex = tuple[0];
if (regex.exec(str)) {
tuple[1]();
var results = regex.exec(str);
if (results) {
tuple[1](results);
}
});
@ -181,7 +189,7 @@ var Command = Backbone.Model.extend({
// see if begins with git
if (str.slice(0,3) !== 'git') {
throw new CommandProcessError({
msg: 'Git commands only, sorry!'
msg: 'That command is not supported, sorry!'
});
}

View file

@ -39,6 +39,7 @@ var CommandPromptView = Backbone.View.extend({
events.on('processCommandFromEvent', this.addToCollection, this);
events.on('submitCommandValueFromEvent', this.submitValue, this);
events.on('rollupCommands', this.rollupCommands, this);
// hacky timeout focus
setTimeout(_.bind(function() {
@ -186,6 +187,22 @@ var CommandPromptView = Backbone.View.extend({
this.submitValue(value);
},
rollupCommands: function(numBack) {
var which = this.commands.toArray().slice(1, Number(numBack) + 1);
console.log(this.commands.toArray());
console.log(which);
var str = '';
_.each(which, function(commandEntry) {
str += commandEntry.get('text') + ';';
}, this);
console.log('the str', str);
var rolled = new CommandEntry({text: str});
this.commands.unshift(rolled);
Backbone.sync('create', rolled, function() { });
},
submitValue: function(value) {
// we should add if it's not a blank line and this is a new command...
// or if we edited the command

View file

@ -559,6 +559,11 @@ var VisNode = VisBase.extend({
this.get('circle').stop().animate(attr.circle, s, e);
this.get('text').stop().animate(attr.text, s, e);
// animate the x attribute without bouncing so it looks like there's
// gravity in only one direction. Just a small animation polish
this.get('circle').animate(attr.circle.cx, s, 'easeInOut');
this.get('text').animate(attr.text.x, s, 'easeInOut');
},
getScreenCoords: function() {