From f3fd386e3b4cf103613c484a0a16c7bb636ed9f5 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 3 Aug 2016 21:03:09 -0700 Subject: [PATCH] Retain time system on mode change --- .../src/ui/TimeConductorController.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js index 9db200cf3c..4a5bbbc6e6 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js @@ -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; @@ -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; @@ -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;