Retain time system on mode change

This commit is contained in:
Henry 2016-08-03 21:03:09 -07:00
parent 25b9f371e2
commit f3fd386e3b

View File

@ -212,6 +212,7 @@ define(
var newMode = undefined; var newMode = undefined;
var timeSystems = []; var timeSystems = [];
var timeSystem = undefined; var timeSystem = undefined;
var $scope = this.$scope;
var tickSourceType = this.modes[newModeKey].tickSourceType; var tickSourceType = this.modes[newModeKey].tickSourceType;
this.$scope.modeModel.selectedKey = newModeKey; this.$scope.modeModel.selectedKey = newModeKey;
@ -231,7 +232,14 @@ define(
// Filter time systems to only those with clock tick // Filter time systems to only those with clock tick
// sources // sources
timeSystems = this.timeSystemsForSourceType(tickSourceType); 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 = new FollowMode(this.conductor, timeSystem, newModeKey);
newMode.tickSource(this.selectTickSource(timeSystem, tickSourceType)); newMode.tickSource(this.selectTickSource(timeSystem, tickSourceType));
break; break;
@ -240,7 +248,14 @@ define(
// Filter time systems to only those with data tick // Filter time systems to only those with data tick
// sources // sources
timeSystems = this.timeSystemsForSourceType(tickSourceType); 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 = new FollowMode(this.conductor, timeSystem, newModeKey);
newMode.tickSource(this.selectTickSource(timeSystem, tickSourceType)); newMode.tickSource(this.selectTickSource(timeSystem, tickSourceType));
break; break;