mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
OMG WORST BUG EVER WITH THE WHOLE DEBOUNCE ON PROTOTYPE NEVER AGAIN
This commit is contained in:
parent
4b3e13b0b5
commit
e74266f00e
6 changed files with 144 additions and 48 deletions
108
build/bundle.js
108
build/bundle.js
|
@ -4482,7 +4482,6 @@ var GitShim = require('../git/gitShim').GitShim;
|
||||||
|
|
||||||
var ModalTerminal = require('../views').ModalTerminal;
|
var ModalTerminal = require('../views').ModalTerminal;
|
||||||
var ModalAlert = require('../views').ModalAlert;
|
var ModalAlert = require('../views').ModalAlert;
|
||||||
|
|
||||||
var MultiView = require('../views/multiView').MultiView;
|
var MultiView = require('../views/multiView').MultiView;
|
||||||
|
|
||||||
var Sandbox = Backbone.View.extend({
|
var Sandbox = Backbone.View.extend({
|
||||||
|
@ -4583,6 +4582,21 @@ var Sandbox = Backbone.View.extend({
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
startLevel: function(command, deferred) {
|
||||||
|
var Level = require('../level').Level;
|
||||||
|
this.hide();
|
||||||
|
this.clear();
|
||||||
|
|
||||||
|
console.log(command.get('regexResults'));
|
||||||
|
|
||||||
|
// we don't even need a reference to this,
|
||||||
|
// everything will be handled via event baton :DDDDDDDDD
|
||||||
|
var a = new Level();
|
||||||
|
setTimeout(function() {
|
||||||
|
command.finishWith(deferred);
|
||||||
|
}, this.getAnimationTime());
|
||||||
|
},
|
||||||
|
|
||||||
exitLevel: function(command, deferred) {
|
exitLevel: function(command, deferred) {
|
||||||
command.addWarning(
|
command.addWarning(
|
||||||
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
||||||
|
@ -6258,7 +6272,7 @@ var init = function() {
|
||||||
|
|
||||||
eventBaton = new EventBaton();
|
eventBaton = new EventBaton();
|
||||||
commandUI = new CommandUI();
|
commandUI = new CommandUI();
|
||||||
sandbox = new Level();
|
sandbox = new Sandbox();
|
||||||
|
|
||||||
// we always want to focus the text area to collect input
|
// we always want to focus the text area to collect input
|
||||||
var focusTextArea = function() {
|
var focusTextArea = function() {
|
||||||
|
@ -6825,7 +6839,6 @@ var Visualization = Backbone.View.extend({
|
||||||
this.paper = paper;
|
this.paper = paper;
|
||||||
|
|
||||||
var Main = require('../app');
|
var Main = require('../app');
|
||||||
this.mainEvents = options.events || Main.getEvents();
|
|
||||||
// if we dont want to receive keyoard input (directly),
|
// if we dont want to receive keyoard input (directly),
|
||||||
// make a new event baton so git engine steals something that no one
|
// make a new event baton so git engine steals something that no one
|
||||||
// is broadcasting to
|
// is broadcasting to
|
||||||
|
@ -6853,7 +6866,11 @@ var Visualization = Backbone.View.extend({
|
||||||
this.gitVisuals.assignGitEngine(this.gitEngine);
|
this.gitVisuals.assignGitEngine(this.gitEngine);
|
||||||
|
|
||||||
this.myResize();
|
this.myResize();
|
||||||
this.mainEvents.on('resize', this.myResize, this);
|
|
||||||
|
$(window).on('resize', _.bind(function() {
|
||||||
|
this.myResize();
|
||||||
|
}, this));
|
||||||
|
|
||||||
this.gitVisuals.drawTreeFirstTime();
|
this.gitVisuals.drawTreeFirstTime();
|
||||||
|
|
||||||
if (this.treeString) {
|
if (this.treeString) {
|
||||||
|
@ -6917,10 +6934,9 @@ var Visualization = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
tearDown: function() {
|
tearDown: function() {
|
||||||
// hmm -- dont think this will work to unbind the event listener...
|
|
||||||
this.mainEvents.off('resize', this.myResize, this);
|
|
||||||
this.gitEngine.tearDown();
|
this.gitEngine.tearDown();
|
||||||
this.gitVisuals.tearDown();
|
this.gitVisuals.tearDown();
|
||||||
|
delete this.paper;
|
||||||
},
|
},
|
||||||
|
|
||||||
die: function() {
|
die: function() {
|
||||||
|
@ -6933,6 +6949,8 @@ var Visualization = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
myResize: function() {
|
myResize: function() {
|
||||||
|
if (!this.paper) { return; }
|
||||||
|
|
||||||
var smaller = 1;
|
var smaller = 1;
|
||||||
var el = this.el;
|
var el = this.el;
|
||||||
|
|
||||||
|
@ -6941,7 +6959,7 @@ var Visualization = Backbone.View.extend({
|
||||||
|
|
||||||
// if we don't have a container, we need to set our
|
// if we don't have a container, we need to set our
|
||||||
// position absolutely to whatever we are tracking
|
// position absolutely to whatever we are tracking
|
||||||
if (!this.options.containerElement) {
|
if (!this.containerElement) {
|
||||||
var left = el.offsetLeft;
|
var left = el.offsetLeft;
|
||||||
var top = el.offsetTop;
|
var top = el.offsetTop;
|
||||||
|
|
||||||
|
@ -12548,7 +12566,7 @@ var regexMap = {
|
||||||
'delay': /^delay (\d+)$/,
|
'delay': /^delay (\d+)$/,
|
||||||
'clear': /^clear($|\s)/,
|
'clear': /^clear($|\s)/,
|
||||||
'exit level': /^exit level($|\s)/,
|
'exit level': /^exit level($|\s)/,
|
||||||
'start level': /^start level ([a-zA-Z0-9]+)/
|
'start level': /^start level\s?([a-zA-Z0-9]*)/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = function(str) {
|
var parse = function(str) {
|
||||||
|
@ -13308,15 +13326,29 @@ GitVisuals.prototype.calcDepthRecursive = function(commit, depth) {
|
||||||
|
|
||||||
// we debounce here so we aren't firing a resize call on every resize event
|
// we debounce here so we aren't firing a resize call on every resize event
|
||||||
// but only after they stop
|
// but only after they stop
|
||||||
GitVisuals.prototype.canvasResize = _.debounce(function(width, height) {
|
GitVisuals.prototype.canvasResize = function(width, height) {
|
||||||
// refresh when we are ready
|
if (!this.resizeFunc) {
|
||||||
|
this.genResizeFunc();
|
||||||
|
}
|
||||||
|
this.resizeFunc(width, height);
|
||||||
|
};
|
||||||
|
|
||||||
|
GitVisuals.prototype.genResizeFunc = function() {
|
||||||
|
this.resizeFunc = _.debounce(
|
||||||
|
_.bind(function(width, height) {
|
||||||
|
|
||||||
|
// refresh when we are ready if we are animating som ething
|
||||||
if (GLOBAL.isAnimating) {
|
if (GLOBAL.isAnimating) {
|
||||||
var Main = require('../app');
|
var Main = require('../app');
|
||||||
Main.getEventBaton().trigger('commandSubmitted', 'refresh');
|
Main.getEventBaton().trigger('commandSubmitted', 'refresh');
|
||||||
} else {
|
} else {
|
||||||
this.refreshTree();
|
this.refreshTree();
|
||||||
}
|
}
|
||||||
}, 200, true);
|
}, this),
|
||||||
|
200,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.addNode = function(id, commit) {
|
GitVisuals.prototype.addNode = function(id, commit) {
|
||||||
this.commitMap[id] = commit;
|
this.commitMap[id] = commit;
|
||||||
|
@ -15487,7 +15519,7 @@ var init = function() {
|
||||||
|
|
||||||
eventBaton = new EventBaton();
|
eventBaton = new EventBaton();
|
||||||
commandUI = new CommandUI();
|
commandUI = new CommandUI();
|
||||||
sandbox = new Level();
|
sandbox = new Sandbox();
|
||||||
|
|
||||||
// we always want to focus the text area to collect input
|
// we always want to focus the text area to collect input
|
||||||
var focusTextArea = function() {
|
var focusTextArea = function() {
|
||||||
|
@ -18346,7 +18378,6 @@ var GitShim = require('../git/gitShim').GitShim;
|
||||||
|
|
||||||
var ModalTerminal = require('../views').ModalTerminal;
|
var ModalTerminal = require('../views').ModalTerminal;
|
||||||
var ModalAlert = require('../views').ModalAlert;
|
var ModalAlert = require('../views').ModalAlert;
|
||||||
|
|
||||||
var MultiView = require('../views/multiView').MultiView;
|
var MultiView = require('../views/multiView').MultiView;
|
||||||
|
|
||||||
var Sandbox = Backbone.View.extend({
|
var Sandbox = Backbone.View.extend({
|
||||||
|
@ -18447,6 +18478,21 @@ var Sandbox = Backbone.View.extend({
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
startLevel: function(command, deferred) {
|
||||||
|
var Level = require('../level').Level;
|
||||||
|
this.hide();
|
||||||
|
this.clear();
|
||||||
|
|
||||||
|
console.log(command.get('regexResults'));
|
||||||
|
|
||||||
|
// we don't even need a reference to this,
|
||||||
|
// everything will be handled via event baton :DDDDDDDDD
|
||||||
|
var a = new Level();
|
||||||
|
setTimeout(function() {
|
||||||
|
command.finishWith(deferred);
|
||||||
|
}, this.getAnimationTime());
|
||||||
|
},
|
||||||
|
|
||||||
exitLevel: function(command, deferred) {
|
exitLevel: function(command, deferred) {
|
||||||
command.addWarning(
|
command.addWarning(
|
||||||
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
||||||
|
@ -18564,7 +18610,7 @@ var regexMap = {
|
||||||
'delay': /^delay (\d+)$/,
|
'delay': /^delay (\d+)$/,
|
||||||
'clear': /^clear($|\s)/,
|
'clear': /^clear($|\s)/,
|
||||||
'exit level': /^exit level($|\s)/,
|
'exit level': /^exit level($|\s)/,
|
||||||
'start level': /^start level ([a-zA-Z0-9]+)/
|
'start level': /^start level\s?([a-zA-Z0-9]*)/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = function(str) {
|
var parse = function(str) {
|
||||||
|
@ -21453,15 +21499,29 @@ GitVisuals.prototype.calcDepthRecursive = function(commit, depth) {
|
||||||
|
|
||||||
// we debounce here so we aren't firing a resize call on every resize event
|
// we debounce here so we aren't firing a resize call on every resize event
|
||||||
// but only after they stop
|
// but only after they stop
|
||||||
GitVisuals.prototype.canvasResize = _.debounce(function(width, height) {
|
GitVisuals.prototype.canvasResize = function(width, height) {
|
||||||
// refresh when we are ready
|
if (!this.resizeFunc) {
|
||||||
|
this.genResizeFunc();
|
||||||
|
}
|
||||||
|
this.resizeFunc(width, height);
|
||||||
|
};
|
||||||
|
|
||||||
|
GitVisuals.prototype.genResizeFunc = function() {
|
||||||
|
this.resizeFunc = _.debounce(
|
||||||
|
_.bind(function(width, height) {
|
||||||
|
|
||||||
|
// refresh when we are ready if we are animating som ething
|
||||||
if (GLOBAL.isAnimating) {
|
if (GLOBAL.isAnimating) {
|
||||||
var Main = require('../app');
|
var Main = require('../app');
|
||||||
Main.getEventBaton().trigger('commandSubmitted', 'refresh');
|
Main.getEventBaton().trigger('commandSubmitted', 'refresh');
|
||||||
} else {
|
} else {
|
||||||
this.refreshTree();
|
this.refreshTree();
|
||||||
}
|
}
|
||||||
}, 200, true);
|
}, this),
|
||||||
|
200,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.addNode = function(id, commit) {
|
GitVisuals.prototype.addNode = function(id, commit) {
|
||||||
this.commitMap[id] = commit;
|
this.commitMap[id] = commit;
|
||||||
|
@ -22726,7 +22786,6 @@ var Visualization = Backbone.View.extend({
|
||||||
this.paper = paper;
|
this.paper = paper;
|
||||||
|
|
||||||
var Main = require('../app');
|
var Main = require('../app');
|
||||||
this.mainEvents = options.events || Main.getEvents();
|
|
||||||
// if we dont want to receive keyoard input (directly),
|
// if we dont want to receive keyoard input (directly),
|
||||||
// make a new event baton so git engine steals something that no one
|
// make a new event baton so git engine steals something that no one
|
||||||
// is broadcasting to
|
// is broadcasting to
|
||||||
|
@ -22754,7 +22813,11 @@ var Visualization = Backbone.View.extend({
|
||||||
this.gitVisuals.assignGitEngine(this.gitEngine);
|
this.gitVisuals.assignGitEngine(this.gitEngine);
|
||||||
|
|
||||||
this.myResize();
|
this.myResize();
|
||||||
this.mainEvents.on('resize', this.myResize, this);
|
|
||||||
|
$(window).on('resize', _.bind(function() {
|
||||||
|
this.myResize();
|
||||||
|
}, this));
|
||||||
|
|
||||||
this.gitVisuals.drawTreeFirstTime();
|
this.gitVisuals.drawTreeFirstTime();
|
||||||
|
|
||||||
if (this.treeString) {
|
if (this.treeString) {
|
||||||
|
@ -22818,10 +22881,9 @@ var Visualization = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
tearDown: function() {
|
tearDown: function() {
|
||||||
// hmm -- dont think this will work to unbind the event listener...
|
|
||||||
this.mainEvents.off('resize', this.myResize, this);
|
|
||||||
this.gitEngine.tearDown();
|
this.gitEngine.tearDown();
|
||||||
this.gitVisuals.tearDown();
|
this.gitVisuals.tearDown();
|
||||||
|
delete this.paper;
|
||||||
},
|
},
|
||||||
|
|
||||||
die: function() {
|
die: function() {
|
||||||
|
@ -22834,6 +22896,8 @@ var Visualization = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
myResize: function() {
|
myResize: function() {
|
||||||
|
if (!this.paper) { return; }
|
||||||
|
|
||||||
var smaller = 1;
|
var smaller = 1;
|
||||||
var el = this.el;
|
var el = this.el;
|
||||||
|
|
||||||
|
@ -22842,7 +22906,7 @@ var Visualization = Backbone.View.extend({
|
||||||
|
|
||||||
// if we don't have a container, we need to set our
|
// if we don't have a container, we need to set our
|
||||||
// position absolutely to whatever we are tracking
|
// position absolutely to whatever we are tracking
|
||||||
if (!this.options.containerElement) {
|
if (!this.containerElement) {
|
||||||
var left = el.offsetLeft;
|
var left = el.offsetLeft;
|
||||||
var top = el.offsetTop;
|
var top = el.offsetTop;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ var init = function() {
|
||||||
|
|
||||||
eventBaton = new EventBaton();
|
eventBaton = new EventBaton();
|
||||||
commandUI = new CommandUI();
|
commandUI = new CommandUI();
|
||||||
sandbox = new Level();
|
sandbox = new Sandbox();
|
||||||
|
|
||||||
// we always want to focus the text area to collect input
|
// we always want to focus the text area to collect input
|
||||||
var focusTextArea = function() {
|
var focusTextArea = function() {
|
||||||
|
|
|
@ -14,7 +14,6 @@ var GitShim = require('../git/gitShim').GitShim;
|
||||||
|
|
||||||
var ModalTerminal = require('../views').ModalTerminal;
|
var ModalTerminal = require('../views').ModalTerminal;
|
||||||
var ModalAlert = require('../views').ModalAlert;
|
var ModalAlert = require('../views').ModalAlert;
|
||||||
|
|
||||||
var MultiView = require('../views/multiView').MultiView;
|
var MultiView = require('../views/multiView').MultiView;
|
||||||
|
|
||||||
var Sandbox = Backbone.View.extend({
|
var Sandbox = Backbone.View.extend({
|
||||||
|
@ -115,6 +114,21 @@ var Sandbox = Backbone.View.extend({
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
startLevel: function(command, deferred) {
|
||||||
|
var Level = require('../level').Level;
|
||||||
|
this.hide();
|
||||||
|
this.clear();
|
||||||
|
|
||||||
|
console.log(command.get('regexResults'));
|
||||||
|
|
||||||
|
// we don't even need a reference to this,
|
||||||
|
// everything will be handled via event baton :DDDDDDDDD
|
||||||
|
var a = new Level();
|
||||||
|
setTimeout(function() {
|
||||||
|
command.finishWith(deferred);
|
||||||
|
}, this.getAnimationTime());
|
||||||
|
},
|
||||||
|
|
||||||
exitLevel: function(command, deferred) {
|
exitLevel: function(command, deferred) {
|
||||||
command.addWarning(
|
command.addWarning(
|
||||||
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
"You aren't in a level! You are in a sandbox, start a level with `start level [id]`"
|
||||||
|
|
|
@ -42,7 +42,7 @@ var regexMap = {
|
||||||
'delay': /^delay (\d+)$/,
|
'delay': /^delay (\d+)$/,
|
||||||
'clear': /^clear($|\s)/,
|
'clear': /^clear($|\s)/,
|
||||||
'exit level': /^exit level($|\s)/,
|
'exit level': /^exit level($|\s)/,
|
||||||
'start level': /^start level ([a-zA-Z0-9]+)/
|
'start level': /^start level\s?([a-zA-Z0-9]*)/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = function(str) {
|
var parse = function(str) {
|
||||||
|
|
|
@ -625,15 +625,29 @@ GitVisuals.prototype.calcDepthRecursive = function(commit, depth) {
|
||||||
|
|
||||||
// we debounce here so we aren't firing a resize call on every resize event
|
// we debounce here so we aren't firing a resize call on every resize event
|
||||||
// but only after they stop
|
// but only after they stop
|
||||||
GitVisuals.prototype.canvasResize = _.debounce(function(width, height) {
|
GitVisuals.prototype.canvasResize = function(width, height) {
|
||||||
// refresh when we are ready
|
if (!this.resizeFunc) {
|
||||||
|
this.genResizeFunc();
|
||||||
|
}
|
||||||
|
this.resizeFunc(width, height);
|
||||||
|
};
|
||||||
|
|
||||||
|
GitVisuals.prototype.genResizeFunc = function() {
|
||||||
|
this.resizeFunc = _.debounce(
|
||||||
|
_.bind(function(width, height) {
|
||||||
|
|
||||||
|
// refresh when we are ready if we are animating som ething
|
||||||
if (GLOBAL.isAnimating) {
|
if (GLOBAL.isAnimating) {
|
||||||
var Main = require('../app');
|
var Main = require('../app');
|
||||||
Main.getEventBaton().trigger('commandSubmitted', 'refresh');
|
Main.getEventBaton().trigger('commandSubmitted', 'refresh');
|
||||||
} else {
|
} else {
|
||||||
this.refreshTree();
|
this.refreshTree();
|
||||||
}
|
}
|
||||||
}, 200, true);
|
}, this),
|
||||||
|
200,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.addNode = function(id, commit) {
|
GitVisuals.prototype.addNode = function(id, commit) {
|
||||||
this.commitMap[id] = commit;
|
this.commitMap[id] = commit;
|
||||||
|
|
|
@ -33,7 +33,6 @@ var Visualization = Backbone.View.extend({
|
||||||
this.paper = paper;
|
this.paper = paper;
|
||||||
|
|
||||||
var Main = require('../app');
|
var Main = require('../app');
|
||||||
this.mainEvents = options.events || Main.getEvents();
|
|
||||||
// if we dont want to receive keyoard input (directly),
|
// if we dont want to receive keyoard input (directly),
|
||||||
// make a new event baton so git engine steals something that no one
|
// make a new event baton so git engine steals something that no one
|
||||||
// is broadcasting to
|
// is broadcasting to
|
||||||
|
@ -61,7 +60,11 @@ var Visualization = Backbone.View.extend({
|
||||||
this.gitVisuals.assignGitEngine(this.gitEngine);
|
this.gitVisuals.assignGitEngine(this.gitEngine);
|
||||||
|
|
||||||
this.myResize();
|
this.myResize();
|
||||||
this.mainEvents.on('resize', this.myResize, this);
|
|
||||||
|
$(window).on('resize', _.bind(function() {
|
||||||
|
this.myResize();
|
||||||
|
}, this));
|
||||||
|
|
||||||
this.gitVisuals.drawTreeFirstTime();
|
this.gitVisuals.drawTreeFirstTime();
|
||||||
|
|
||||||
if (this.treeString) {
|
if (this.treeString) {
|
||||||
|
@ -125,10 +128,9 @@ var Visualization = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
tearDown: function() {
|
tearDown: function() {
|
||||||
// hmm -- dont think this will work to unbind the event listener...
|
|
||||||
this.mainEvents.off('resize', this.myResize, this);
|
|
||||||
this.gitEngine.tearDown();
|
this.gitEngine.tearDown();
|
||||||
this.gitVisuals.tearDown();
|
this.gitVisuals.tearDown();
|
||||||
|
delete this.paper;
|
||||||
},
|
},
|
||||||
|
|
||||||
die: function() {
|
die: function() {
|
||||||
|
@ -141,6 +143,8 @@ var Visualization = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
myResize: function() {
|
myResize: function() {
|
||||||
|
if (!this.paper) { return; }
|
||||||
|
|
||||||
var smaller = 1;
|
var smaller = 1;
|
||||||
var el = this.el;
|
var el = this.el;
|
||||||
|
|
||||||
|
@ -149,7 +153,7 @@ var Visualization = Backbone.View.extend({
|
||||||
|
|
||||||
// if we don't have a container, we need to set our
|
// if we don't have a container, we need to set our
|
||||||
// position absolutely to whatever we are tracking
|
// position absolutely to whatever we are tracking
|
||||||
if (!this.options.containerElement) {
|
if (!this.containerElement) {
|
||||||
var left = el.offsetLeft;
|
var left = el.offsetLeft;
|
||||||
var top = el.offsetTop;
|
var top = el.offsetTop;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue