converted flip treey

This commit is contained in:
Peter Cottle 2015-03-28 14:22:06 -07:00
parent c7cede468b
commit 82c3e75394
3 changed files with 11 additions and 15 deletions

View file

@ -10,6 +10,8 @@ var Errors = require('../util/errors');
var CommandProcessError = Errors.CommandProcessError;
var LocaleStore = require('../stores/LocaleStore');
var LocaleActions = require('../actions/LocaleActions');
var GlobalStateStore = require('../stores/GlobalStateStore');
var GlobalStateActions = require('../actions/GlobalStateActions');
var GitError = Errors.GitError;
var Warning = Errors.Warning;
var CommandResult = Errors.CommandResult;
@ -60,10 +62,10 @@ var instantCommands = [
});
}],
[/^flip$/, function() {
GlobalState.flipTreeY = !GlobalState.flipTreeY;
var events = require('../app').getEvents();
events.trigger('refreshTree');
GlobalStateActions.changeFlipTreeY(
!GlobalStateStore.getFlipTreeY()
);
require('../app').getEvents().trigger('refreshTree');
throw new CommandResult({
msg: intl.str('flip-tree-command')
});

View file

@ -1,14 +1,8 @@
var _ = require('underscore');
var Q = require('q');
var Backbone = require('backbone');
var GRAPHICS = require('../util/constants').GRAPHICS;
var GlobalState = require('../util/globalState');
var Collections = require('../models/collections');
var CommitCollection = Collections.CommitCollection;
var BranchCollection = Collections.BranchCollection;
var TagCollection = Collections.TagCollection;
var GlobalStateStore = require('../stores/GlobalStateStore');
var VisNode = require('../visuals/visNode').VisNode;
var VisBranch = require('../visuals/visBranch').VisBranch;
@ -125,7 +119,7 @@ GitVisuals.prototype.initHeadBranch = function() {
GitVisuals.prototype.getScreenPadding = function() {
// 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
return {
@ -187,7 +181,7 @@ GitVisuals.prototype.toScreenCoords = function(pos) {
var y =
asymShrink(pos.y, this.paper.height, padding.topHeightPadding, padding.bottomHeightPadding);
if (GlobalState.flipTreeY) {
if (GlobalStateStore.getFlipTreeY()) {
y = this.paper.height - y;
}

View file

@ -3,7 +3,7 @@ var Backbone = require('backbone');
var GRAPHICS = require('../util/constants').GRAPHICS;
var VisBase = require('../visuals/visBase').VisBase;
var GlobalState = require('../util/globalState');
var GlobalStateStore = require('../stores/GlobalStateStore');
var VisEdge = VisBase.extend({
defaults: {
@ -52,7 +52,7 @@ var VisEdge = VisBase.extend({
// 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.
var flipFactor = (GlobalState.flipTreeY) ? -1 : 1;
var flipFactor = (GlobalStateStore.getFlipTreeY()) ? -1 : 1;
var coords = function(pos) {
return String(Math.round(pos.x)) + ',' + String(Math.round(pos.y));
};