mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-04 11:44:27 +02:00
makes other vis now too
This commit is contained in:
parent
9173e75c1a
commit
29d401e701
4 changed files with 147 additions and 18 deletions
114
build/bundle.js
114
build/bundle.js
|
@ -6688,7 +6688,8 @@ var Visualization = Backbone.View.extend({
|
||||||
branchCollection: this.branchCollection,
|
branchCollection: this.branchCollection,
|
||||||
paper: this.paper,
|
paper: this.paper,
|
||||||
noClick: this.options.noClick,
|
noClick: this.options.noClick,
|
||||||
smallCanvas: this.options.smallCanvas
|
smallCanvas: this.options.smallCanvas,
|
||||||
|
visualization: this
|
||||||
});
|
});
|
||||||
|
|
||||||
var GitEngine = require('../git').GitEngine;
|
var GitEngine = require('../git').GitEngine;
|
||||||
|
@ -6724,6 +6725,24 @@ var Visualization = Backbone.View.extend({
|
||||||
this.customEvents.trigger('paperReady');
|
this.customEvents.trigger('paperReady');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
makeOrigin: function(options) {
|
||||||
|
// oh god, here we go. We basically do a bizarre form of composition here,
|
||||||
|
// where this visualization actually contains another one of itself.
|
||||||
|
this.originVis = new Visualization(_.extend(
|
||||||
|
{},
|
||||||
|
// copy all of our options over, except...
|
||||||
|
this.options,
|
||||||
|
{
|
||||||
|
// never accept keyboard input or clicks
|
||||||
|
noKeyboardInput: true,
|
||||||
|
noClick: true,
|
||||||
|
treeString: JSON.stringify(options.tree)
|
||||||
|
}
|
||||||
|
));
|
||||||
|
// return the newly created gitEngine
|
||||||
|
return this.originVis.gitEngine;
|
||||||
|
},
|
||||||
|
|
||||||
setTreeIndex: function(level) {
|
setTreeIndex: function(level) {
|
||||||
$(this.paper.canvas).css('z-index', level);
|
$(this.paper.canvas).css('z-index', level);
|
||||||
},
|
},
|
||||||
|
@ -6982,7 +7001,7 @@ function GitEngine(options) {
|
||||||
this.refs = {};
|
this.refs = {};
|
||||||
this.HEAD = null;
|
this.HEAD = null;
|
||||||
this.origin = null;
|
this.origin = null;
|
||||||
this.localRepo = options.localRepro;
|
this.localRepo = null;
|
||||||
|
|
||||||
this.branchCollection = options.branches;
|
this.branchCollection = options.branches;
|
||||||
this.commitCollection = options.collection;
|
this.commitCollection = options.collection;
|
||||||
|
@ -7012,6 +7031,10 @@ GitEngine.prototype.initUniqueID = function() {
|
||||||
})();
|
})();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitEngine.prototype.assignLocalRepo = function(repo) {
|
||||||
|
this.localRepo = repo;
|
||||||
|
};
|
||||||
|
|
||||||
GitEngine.prototype.defaultInit = function() {
|
GitEngine.prototype.defaultInit = function() {
|
||||||
var defaultTree = this.getDefaultTree();
|
var defaultTree = this.getDefaultTree();
|
||||||
this.loadTree(defaultTree);
|
this.loadTree(defaultTree);
|
||||||
|
@ -7043,7 +7066,7 @@ GitEngine.prototype.hasOrigin = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.isOrigin = function() {
|
GitEngine.prototype.isOrigin = function() {
|
||||||
return false;
|
return !!this.localRepro;
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.exportTree = function() {
|
GitEngine.prototype.exportTree = function() {
|
||||||
|
@ -7155,11 +7178,26 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.makeOrigin = function(tree) {
|
GitEngine.prototype.makeOrigin = function(tree) {
|
||||||
this.origin = new GitEngine({
|
if (this.hasOrigin()) {
|
||||||
localRepo: this,
|
throw new GitError({
|
||||||
// dont let it intercept commands
|
msg: intl.str('git-error-options')
|
||||||
eventBaton: new EventBaton()
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is super super ugly but a necessary hack because of the way LGB was
|
||||||
|
// originally designed. We need to get to the top level visualization from
|
||||||
|
// the git engine -- aka we need to access our own visuals, then the
|
||||||
|
// visualization and ask the main vis to create a new vis/git pair. Then
|
||||||
|
// we grab the gitengine out of that and assign that as our origin repo
|
||||||
|
// which connects the two
|
||||||
|
var masterVis = this.gitVisuals.getVisualization();
|
||||||
|
var originRepo = masterVis.makeOrigin({
|
||||||
|
localRepo: this,
|
||||||
|
tree: this.getDefaultTree()
|
||||||
|
});
|
||||||
|
|
||||||
|
this.origin = originRepo;
|
||||||
|
originRepo.assignLocalRepo(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||||
|
@ -14870,6 +14908,7 @@ var VisEdgeCollection = require('../visuals/visEdge').VisEdgeCollection;
|
||||||
function GitVisuals(options) {
|
function GitVisuals(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
this.visualization = options.visualization;
|
||||||
this.commitCollection = options.commitCollection;
|
this.commitCollection = options.commitCollection;
|
||||||
this.branchCollection = options.branchCollection;
|
this.branchCollection = options.branchCollection;
|
||||||
this.visNodeMap = {};
|
this.visNodeMap = {};
|
||||||
|
@ -14943,6 +14982,10 @@ GitVisuals.prototype.assignGitEngine = function(gitEngine) {
|
||||||
this.deferFlush();
|
this.deferFlush();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitVisuals.prototype.getVisualization = function() {
|
||||||
|
return this.visualization;
|
||||||
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.initHeadBranch = function() {
|
GitVisuals.prototype.initHeadBranch = function() {
|
||||||
// it's unfortaunte we have to do this, but the head branch
|
// it's unfortaunte we have to do this, but the head branch
|
||||||
// is an edge case because it's not part of a collection so
|
// is an edge case because it's not part of a collection so
|
||||||
|
@ -22470,7 +22513,7 @@ function GitEngine(options) {
|
||||||
this.refs = {};
|
this.refs = {};
|
||||||
this.HEAD = null;
|
this.HEAD = null;
|
||||||
this.origin = null;
|
this.origin = null;
|
||||||
this.localRepo = options.localRepro;
|
this.localRepo = null;
|
||||||
|
|
||||||
this.branchCollection = options.branches;
|
this.branchCollection = options.branches;
|
||||||
this.commitCollection = options.collection;
|
this.commitCollection = options.collection;
|
||||||
|
@ -22500,6 +22543,10 @@ GitEngine.prototype.initUniqueID = function() {
|
||||||
})();
|
})();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitEngine.prototype.assignLocalRepo = function(repo) {
|
||||||
|
this.localRepo = repo;
|
||||||
|
};
|
||||||
|
|
||||||
GitEngine.prototype.defaultInit = function() {
|
GitEngine.prototype.defaultInit = function() {
|
||||||
var defaultTree = this.getDefaultTree();
|
var defaultTree = this.getDefaultTree();
|
||||||
this.loadTree(defaultTree);
|
this.loadTree(defaultTree);
|
||||||
|
@ -22531,7 +22578,7 @@ GitEngine.prototype.hasOrigin = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.isOrigin = function() {
|
GitEngine.prototype.isOrigin = function() {
|
||||||
return false;
|
return !!this.localRepro;
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.exportTree = function() {
|
GitEngine.prototype.exportTree = function() {
|
||||||
|
@ -22643,11 +22690,26 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.makeOrigin = function(tree) {
|
GitEngine.prototype.makeOrigin = function(tree) {
|
||||||
this.origin = new GitEngine({
|
if (this.hasOrigin()) {
|
||||||
localRepo: this,
|
throw new GitError({
|
||||||
// dont let it intercept commands
|
msg: intl.str('git-error-options')
|
||||||
eventBaton: new EventBaton()
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is super super ugly but a necessary hack because of the way LGB was
|
||||||
|
// originally designed. We need to get to the top level visualization from
|
||||||
|
// the git engine -- aka we need to access our own visuals, then the
|
||||||
|
// visualization and ask the main vis to create a new vis/git pair. Then
|
||||||
|
// we grab the gitengine out of that and assign that as our origin repo
|
||||||
|
// which connects the two
|
||||||
|
var masterVis = this.gitVisuals.getVisualization();
|
||||||
|
var originRepo = masterVis.makeOrigin({
|
||||||
|
localRepo: this,
|
||||||
|
tree: this.getDefaultTree()
|
||||||
|
});
|
||||||
|
|
||||||
|
this.origin = originRepo;
|
||||||
|
originRepo.assignLocalRepo(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||||
|
@ -30807,6 +30869,7 @@ var VisEdgeCollection = require('../visuals/visEdge').VisEdgeCollection;
|
||||||
function GitVisuals(options) {
|
function GitVisuals(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
this.visualization = options.visualization;
|
||||||
this.commitCollection = options.commitCollection;
|
this.commitCollection = options.commitCollection;
|
||||||
this.branchCollection = options.branchCollection;
|
this.branchCollection = options.branchCollection;
|
||||||
this.visNodeMap = {};
|
this.visNodeMap = {};
|
||||||
|
@ -30880,6 +30943,10 @@ GitVisuals.prototype.assignGitEngine = function(gitEngine) {
|
||||||
this.deferFlush();
|
this.deferFlush();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitVisuals.prototype.getVisualization = function() {
|
||||||
|
return this.visualization;
|
||||||
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.initHeadBranch = function() {
|
GitVisuals.prototype.initHeadBranch = function() {
|
||||||
// it's unfortaunte we have to do this, but the head branch
|
// it's unfortaunte we have to do this, but the head branch
|
||||||
// is an edge case because it's not part of a collection so
|
// is an edge case because it's not part of a collection so
|
||||||
|
@ -32911,7 +32978,8 @@ var Visualization = Backbone.View.extend({
|
||||||
branchCollection: this.branchCollection,
|
branchCollection: this.branchCollection,
|
||||||
paper: this.paper,
|
paper: this.paper,
|
||||||
noClick: this.options.noClick,
|
noClick: this.options.noClick,
|
||||||
smallCanvas: this.options.smallCanvas
|
smallCanvas: this.options.smallCanvas,
|
||||||
|
visualization: this
|
||||||
});
|
});
|
||||||
|
|
||||||
var GitEngine = require('../git').GitEngine;
|
var GitEngine = require('../git').GitEngine;
|
||||||
|
@ -32947,6 +33015,24 @@ var Visualization = Backbone.View.extend({
|
||||||
this.customEvents.trigger('paperReady');
|
this.customEvents.trigger('paperReady');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
makeOrigin: function(options) {
|
||||||
|
// oh god, here we go. We basically do a bizarre form of composition here,
|
||||||
|
// where this visualization actually contains another one of itself.
|
||||||
|
this.originVis = new Visualization(_.extend(
|
||||||
|
{},
|
||||||
|
// copy all of our options over, except...
|
||||||
|
this.options,
|
||||||
|
{
|
||||||
|
// never accept keyboard input or clicks
|
||||||
|
noKeyboardInput: true,
|
||||||
|
noClick: true,
|
||||||
|
treeString: JSON.stringify(options.tree)
|
||||||
|
}
|
||||||
|
));
|
||||||
|
// return the newly created gitEngine
|
||||||
|
return this.originVis.gitEngine;
|
||||||
|
},
|
||||||
|
|
||||||
setTreeIndex: function(level) {
|
setTreeIndex: function(level) {
|
||||||
$(this.paper.canvas).css('z-index', level);
|
$(this.paper.canvas).css('z-index', level);
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,7 +19,7 @@ function GitEngine(options) {
|
||||||
this.refs = {};
|
this.refs = {};
|
||||||
this.HEAD = null;
|
this.HEAD = null;
|
||||||
this.origin = null;
|
this.origin = null;
|
||||||
this.localRepo = options.localRepro;
|
this.localRepo = null;
|
||||||
|
|
||||||
this.branchCollection = options.branches;
|
this.branchCollection = options.branches;
|
||||||
this.commitCollection = options.collection;
|
this.commitCollection = options.collection;
|
||||||
|
@ -49,6 +49,10 @@ GitEngine.prototype.initUniqueID = function() {
|
||||||
})();
|
})();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitEngine.prototype.assignLocalRepo = function(repo) {
|
||||||
|
this.localRepo = repo;
|
||||||
|
};
|
||||||
|
|
||||||
GitEngine.prototype.defaultInit = function() {
|
GitEngine.prototype.defaultInit = function() {
|
||||||
var defaultTree = this.getDefaultTree();
|
var defaultTree = this.getDefaultTree();
|
||||||
this.loadTree(defaultTree);
|
this.loadTree(defaultTree);
|
||||||
|
@ -80,7 +84,7 @@ GitEngine.prototype.hasOrigin = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.isOrigin = function() {
|
GitEngine.prototype.isOrigin = function() {
|
||||||
return false;
|
return !!this.localRepro;
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.exportTree = function() {
|
GitEngine.prototype.exportTree = function() {
|
||||||
|
@ -192,11 +196,26 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.makeOrigin = function(tree) {
|
GitEngine.prototype.makeOrigin = function(tree) {
|
||||||
this.origin = new GitEngine({
|
if (this.hasOrigin()) {
|
||||||
localRepo: this,
|
throw new GitError({
|
||||||
// dont let it intercept commands
|
msg: intl.str('git-error-options')
|
||||||
eventBaton: new EventBaton()
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is super super ugly but a necessary hack because of the way LGB was
|
||||||
|
// originally designed. We need to get to the top level visualization from
|
||||||
|
// the git engine -- aka we need to access our own visuals, then the
|
||||||
|
// visualization and ask the main vis to create a new vis/git pair. Then
|
||||||
|
// we grab the gitengine out of that and assign that as our origin repo
|
||||||
|
// which connects the two
|
||||||
|
var masterVis = this.gitVisuals.getVisualization();
|
||||||
|
var originRepo = masterVis.makeOrigin({
|
||||||
|
localRepo: this,
|
||||||
|
tree: this.getDefaultTree()
|
||||||
|
});
|
||||||
|
|
||||||
|
this.origin = originRepo;
|
||||||
|
originRepo.assignLocalRepo(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||||
|
|
|
@ -18,6 +18,7 @@ var VisEdgeCollection = require('../visuals/visEdge').VisEdgeCollection;
|
||||||
function GitVisuals(options) {
|
function GitVisuals(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
this.visualization = options.visualization;
|
||||||
this.commitCollection = options.commitCollection;
|
this.commitCollection = options.commitCollection;
|
||||||
this.branchCollection = options.branchCollection;
|
this.branchCollection = options.branchCollection;
|
||||||
this.visNodeMap = {};
|
this.visNodeMap = {};
|
||||||
|
@ -91,6 +92,10 @@ GitVisuals.prototype.assignGitEngine = function(gitEngine) {
|
||||||
this.deferFlush();
|
this.deferFlush();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitVisuals.prototype.getVisualization = function() {
|
||||||
|
return this.visualization;
|
||||||
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.initHeadBranch = function() {
|
GitVisuals.prototype.initHeadBranch = function() {
|
||||||
// it's unfortaunte we have to do this, but the head branch
|
// it's unfortaunte we have to do this, but the head branch
|
||||||
// is an edge case because it's not part of a collection so
|
// is an edge case because it's not part of a collection so
|
||||||
|
|
|
@ -49,7 +49,8 @@ var Visualization = Backbone.View.extend({
|
||||||
branchCollection: this.branchCollection,
|
branchCollection: this.branchCollection,
|
||||||
paper: this.paper,
|
paper: this.paper,
|
||||||
noClick: this.options.noClick,
|
noClick: this.options.noClick,
|
||||||
smallCanvas: this.options.smallCanvas
|
smallCanvas: this.options.smallCanvas,
|
||||||
|
visualization: this
|
||||||
});
|
});
|
||||||
|
|
||||||
var GitEngine = require('../git').GitEngine;
|
var GitEngine = require('../git').GitEngine;
|
||||||
|
@ -85,6 +86,24 @@ var Visualization = Backbone.View.extend({
|
||||||
this.customEvents.trigger('paperReady');
|
this.customEvents.trigger('paperReady');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
makeOrigin: function(options) {
|
||||||
|
// oh god, here we go. We basically do a bizarre form of composition here,
|
||||||
|
// where this visualization actually contains another one of itself.
|
||||||
|
this.originVis = new Visualization(_.extend(
|
||||||
|
{},
|
||||||
|
// copy all of our options over, except...
|
||||||
|
this.options,
|
||||||
|
{
|
||||||
|
// never accept keyboard input or clicks
|
||||||
|
noKeyboardInput: true,
|
||||||
|
noClick: true,
|
||||||
|
treeString: JSON.stringify(options.tree)
|
||||||
|
}
|
||||||
|
));
|
||||||
|
// return the newly created gitEngine
|
||||||
|
return this.originVis.gitEngine;
|
||||||
|
},
|
||||||
|
|
||||||
setTreeIndex: function(level) {
|
setTreeIndex: function(level) {
|
||||||
$(this.paper.canvas).css('z-index', level);
|
$(this.paper.canvas).css('z-index', level);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue