mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-02 10:44:28 +02:00
big progress
This commit is contained in:
parent
096ec32393
commit
0358291e6f
7 changed files with 171 additions and 122 deletions
|
@ -44,6 +44,9 @@ var init = function() {
|
|||
$(document).click(function(e) {
|
||||
eventBaton.trigger('documentClick', e);
|
||||
});
|
||||
$(window).on('resize', function(e) {
|
||||
events.trigger('resize', e);
|
||||
});
|
||||
|
||||
// zoom level measure, I wish there was a jquery event for this :/
|
||||
require('../util/zoomLevel').setupZoomPoll(function(level) {
|
||||
|
|
|
@ -65,7 +65,8 @@ var Level = Sandbox.extend({
|
|||
this.goalVis = new Visualization({
|
||||
el: this.goalCanvasHolder.getCanvasLocation(),
|
||||
containerElement: this.goalCanvasHolder.getCanvasLocation(),
|
||||
treeString: this.goalTreeString
|
||||
treeString: this.goalTreeString,
|
||||
noKeyboardInput: true
|
||||
});
|
||||
|
||||
this.goalVis.customEvents.on('paperReady', _.bind(function() {
|
||||
|
|
|
@ -16,7 +16,8 @@ var toGlobalize = {
|
|||
RebaseView: require('../views/rebaseView'),
|
||||
Views: require('../views'),
|
||||
MultiView: require('../views/multiView'),
|
||||
ZoomLevel: require('../util/zoomLevel')
|
||||
ZoomLevel: require('../util/zoomLevel'),
|
||||
VisBranch: require('../visuals/visBranch')
|
||||
};
|
||||
|
||||
_.each(toGlobalize, function(module) {
|
||||
|
@ -27,5 +28,6 @@ $(document).ready(function() {
|
|||
window.events = toGlobalize.Main.getEvents();
|
||||
window.eventBaton = toGlobalize.Main.getEventBaton();
|
||||
window.sandbox = toGlobalize.Main.getSandbox();
|
||||
window.modules = toGlobalize;
|
||||
});
|
||||
|
||||
|
|
|
@ -633,7 +633,7 @@ GitVisuals.prototype.canvasResize = _.debounce(function(width, height) {
|
|||
} else {
|
||||
this.refreshTree();
|
||||
}
|
||||
}, 200);
|
||||
}, 200, true);
|
||||
|
||||
GitVisuals.prototype.addNode = function(id, commit) {
|
||||
this.commitMap[id] = commit;
|
||||
|
|
|
@ -416,3 +416,5 @@ var VisBranchCollection = Backbone.Collection.extend({
|
|||
|
||||
exports.VisBranchCollection = VisBranchCollection;
|
||||
exports.VisBranch = VisBranch;
|
||||
exports.randomHueString = randomHueString;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ var Backbone = (!require('../util').isBrowser()) ? Backbone = require('backbone'
|
|||
var Collections = require('../models/collections');
|
||||
var CommitCollection = Collections.CommitCollection;
|
||||
var BranchCollection = Collections.BranchCollection;
|
||||
var EventBaton = require('../util/eventBaton').EventBaton;
|
||||
|
||||
var GitVisuals = require('../visuals').GitVisuals;
|
||||
|
||||
|
@ -33,7 +34,12 @@ var Visualization = Backbone.View.extend({
|
|||
|
||||
var Main = require('../app');
|
||||
this.events = options.events || Main.getEvents();
|
||||
this.eventBaton = options.eventBaton || Main.getEventBaton();
|
||||
// if we dont want to receive keyoard input (directly),
|
||||
// make a new event baton so git engine steals something that no one
|
||||
// is broadcasting to
|
||||
this.eventBaton = (options.noKeyboardInput) ?
|
||||
new EventBaton():
|
||||
Main.getEventBaton();
|
||||
|
||||
this.commitCollection = new CommitCollection();
|
||||
this.branchCollection = new BranchCollection();
|
||||
|
@ -55,7 +61,7 @@ var Visualization = Backbone.View.extend({
|
|||
this.gitVisuals.assignGitEngine(this.gitEngine);
|
||||
|
||||
this.myResize();
|
||||
$(window).on('resize', _.bind(this.myResize, this));
|
||||
this.events.on('resize', this.myResize, this);
|
||||
this.gitVisuals.drawTreeFirstTime();
|
||||
|
||||
if (this.treeString) {
|
||||
|
@ -64,7 +70,10 @@ var Visualization = Backbone.View.extend({
|
|||
|
||||
this.shown = false;
|
||||
this.setTreeOpacity(0);
|
||||
this.fadeTreeIn();
|
||||
// reflow needed
|
||||
process.nextTick(_.bind(function() {
|
||||
this.fadeTreeIn();
|
||||
}, this));
|
||||
|
||||
this.customEvents.trigger('gitEngineReady');
|
||||
this.customEvents.trigger('paperReady');
|
||||
|
@ -123,7 +132,7 @@ var Visualization = Backbone.View.extend({
|
|||
|
||||
tearDown: function() {
|
||||
// hmm -- dont think this will work to unbind the event listener...
|
||||
$(window).off('resize', _.bind(this.myResize, this));
|
||||
this.events.off('resize', this.myResize, this);
|
||||
this.gitVisuals.tearDown();
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue