diff --git a/src/js/sandbox/commands.js b/src/js/sandbox/commands.js index 41eb183f..ca693b7a 100644 --- a/src/js/sandbox/commands.js +++ b/src/js/sandbox/commands.js @@ -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') }); diff --git a/src/js/visuals/index.js b/src/js/visuals/index.js index 7eef956f..dbaedf5a 100644 --- a/src/js/visuals/index.js +++ b/src/js/visuals/index.js @@ -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; } diff --git a/src/js/visuals/visEdge.js b/src/js/visuals/visEdge.js index 0cdbbab4..b47ef8de 100644 --- a/src/js/visuals/visEdge.js +++ b/src/js/visuals/visEdge.js @@ -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)); };