mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-30 01:34:26 +02:00
converted flip treey
This commit is contained in:
parent
c7cede468b
commit
82c3e75394
3 changed files with 11 additions and 15 deletions
|
@ -10,6 +10,8 @@ var Errors = require('../util/errors');
|
||||||
var CommandProcessError = Errors.CommandProcessError;
|
var CommandProcessError = Errors.CommandProcessError;
|
||||||
var LocaleStore = require('../stores/LocaleStore');
|
var LocaleStore = require('../stores/LocaleStore');
|
||||||
var LocaleActions = require('../actions/LocaleActions');
|
var LocaleActions = require('../actions/LocaleActions');
|
||||||
|
var GlobalStateStore = require('../stores/GlobalStateStore');
|
||||||
|
var GlobalStateActions = require('../actions/GlobalStateActions');
|
||||||
var GitError = Errors.GitError;
|
var GitError = Errors.GitError;
|
||||||
var Warning = Errors.Warning;
|
var Warning = Errors.Warning;
|
||||||
var CommandResult = Errors.CommandResult;
|
var CommandResult = Errors.CommandResult;
|
||||||
|
@ -60,10 +62,10 @@ var instantCommands = [
|
||||||
});
|
});
|
||||||
}],
|
}],
|
||||||
[/^flip$/, function() {
|
[/^flip$/, function() {
|
||||||
GlobalState.flipTreeY = !GlobalState.flipTreeY;
|
GlobalStateActions.changeFlipTreeY(
|
||||||
|
!GlobalStateStore.getFlipTreeY()
|
||||||
var events = require('../app').getEvents();
|
);
|
||||||
events.trigger('refreshTree');
|
require('../app').getEvents().trigger('refreshTree');
|
||||||
throw new CommandResult({
|
throw new CommandResult({
|
||||||
msg: intl.str('flip-tree-command')
|
msg: intl.str('flip-tree-command')
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
var Q = require('q');
|
var Q = require('q');
|
||||||
var Backbone = require('backbone');
|
|
||||||
|
|
||||||
var GRAPHICS = require('../util/constants').GRAPHICS;
|
var GRAPHICS = require('../util/constants').GRAPHICS;
|
||||||
var GlobalState = require('../util/globalState');
|
var GlobalStateStore = require('../stores/GlobalStateStore');
|
||||||
|
|
||||||
var Collections = require('../models/collections');
|
|
||||||
var CommitCollection = Collections.CommitCollection;
|
|
||||||
var BranchCollection = Collections.BranchCollection;
|
|
||||||
var TagCollection = Collections.TagCollection;
|
|
||||||
|
|
||||||
var VisNode = require('../visuals/visNode').VisNode;
|
var VisNode = require('../visuals/visNode').VisNode;
|
||||||
var VisBranch = require('../visuals/visBranch').VisBranch;
|
var VisBranch = require('../visuals/visBranch').VisBranch;
|
||||||
|
@ -125,7 +119,7 @@ GitVisuals.prototype.initHeadBranch = function() {
|
||||||
|
|
||||||
GitVisuals.prototype.getScreenPadding = function() {
|
GitVisuals.prototype.getScreenPadding = function() {
|
||||||
// if we are flipping the tree, the helper bar gets in the way
|
// if we are flipping the tree, the helper bar gets in the way
|
||||||
var topFactor = (GlobalState.flipTreeY) ? 3 : 1.5;
|
var topFactor = (GlobalStateStore.getFlipTreeY()) ? 3 : 1.5;
|
||||||
|
|
||||||
// for now we return the node radius subtracted from the walls
|
// for now we return the node radius subtracted from the walls
|
||||||
return {
|
return {
|
||||||
|
@ -187,7 +181,7 @@ GitVisuals.prototype.toScreenCoords = function(pos) {
|
||||||
var y =
|
var y =
|
||||||
asymShrink(pos.y, this.paper.height, padding.topHeightPadding, padding.bottomHeightPadding);
|
asymShrink(pos.y, this.paper.height, padding.topHeightPadding, padding.bottomHeightPadding);
|
||||||
|
|
||||||
if (GlobalState.flipTreeY) {
|
if (GlobalStateStore.getFlipTreeY()) {
|
||||||
y = this.paper.height - y;
|
y = this.paper.height - y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ var Backbone = require('backbone');
|
||||||
var GRAPHICS = require('../util/constants').GRAPHICS;
|
var GRAPHICS = require('../util/constants').GRAPHICS;
|
||||||
|
|
||||||
var VisBase = require('../visuals/visBase').VisBase;
|
var VisBase = require('../visuals/visBase').VisBase;
|
||||||
var GlobalState = require('../util/globalState');
|
var GlobalStateStore = require('../stores/GlobalStateStore');
|
||||||
|
|
||||||
var VisEdge = VisBase.extend({
|
var VisEdge = VisBase.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
|
@ -52,7 +52,7 @@ var VisEdge = VisBase.extend({
|
||||||
// is M(move abs) C (curve to) (control point 1) (control point 2) (final point)
|
// is M(move abs) C (curve to) (control point 1) (control point 2) (final point)
|
||||||
// the control points have to be __below__ to get the curve starting off straight.
|
// the control points have to be __below__ to get the curve starting off straight.
|
||||||
|
|
||||||
var flipFactor = (GlobalState.flipTreeY) ? -1 : 1;
|
var flipFactor = (GlobalStateStore.getFlipTreeY()) ? -1 : 1;
|
||||||
var coords = function(pos) {
|
var coords = function(pos) {
|
||||||
return String(Math.round(pos.x)) + ',' + String(Math.round(pos.y));
|
return String(Math.round(pos.x)) + ',' + String(Math.round(pos.y));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue