Skip to content

Commit

Permalink
Retain time system on mode change
Browse files Browse the repository at this point in the history
  • Loading branch information
akhenry committed Aug 4, 2016
1 parent 25b9f37 commit f3fd386
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ define(
var newMode = undefined;
var timeSystems = [];
var timeSystem = undefined;
var $scope = this.$scope;
var tickSourceType = this.modes[newModeKey].tickSourceType;

this.$scope.modeModel.selectedKey = newModeKey;
Expand All @@ -231,7 +232,14 @@ define(
// Filter time systems to only those with clock tick
// sources
timeSystems = this.timeSystemsForSourceType(tickSourceType);
timeSystem = timeSystems[0];

//Retain currently selected time system if available
timeSystem = timeSystems.filter(function (t) {
return t.metadata.key === $scope.timeSystemModel.selected.metadata.key;
})[0];
//Default to first available time system
timeSystem = timeSystem || timeSystems[0];

newMode = new FollowMode(this.conductor, timeSystem, newModeKey);
newMode.tickSource(this.selectTickSource(timeSystem, tickSourceType));
break;
Expand All @@ -240,7 +248,14 @@ define(
// Filter time systems to only those with data tick
// sources
timeSystems = this.timeSystemsForSourceType(tickSourceType);
timeSystem = timeSystems[0];

//Retain currently selected time system if available
timeSystem = timeSystems.filter(function (t) {
return t.metadata.key === $scope.timeSystemModel.selected.metadata.key;
})[0];
//Default to first available time system
timeSystem = timeSystem || timeSystems[0];

newMode = new FollowMode(this.conductor, timeSystem, newModeKey);
newMode.tickSource(this.selectTickSource(timeSystem, tickSourceType));
break;
Expand Down

0 comments on commit f3fd386

Please sign in to comment.