Skip to content

Commit f3fd386

Browse files
committed
Retain time system on mode change
1 parent 25b9f37 commit f3fd386

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ define(
212212
var newMode = undefined;
213213
var timeSystems = [];
214214
var timeSystem = undefined;
215+
var $scope = this.$scope;
215216
var tickSourceType = this.modes[newModeKey].tickSourceType;
216217

217218
this.$scope.modeModel.selectedKey = newModeKey;
@@ -231,7 +232,14 @@ define(
231232
// Filter time systems to only those with clock tick
232233
// sources
233234
timeSystems = this.timeSystemsForSourceType(tickSourceType);
234-
timeSystem = timeSystems[0];
235+
236+
//Retain currently selected time system if available
237+
timeSystem = timeSystems.filter(function (t) {
238+
return t.metadata.key === $scope.timeSystemModel.selected.metadata.key;
239+
})[0];
240+
//Default to first available time system
241+
timeSystem = timeSystem || timeSystems[0];
242+
235243
newMode = new FollowMode(this.conductor, timeSystem, newModeKey);
236244
newMode.tickSource(this.selectTickSource(timeSystem, tickSourceType));
237245
break;
@@ -240,7 +248,14 @@ define(
240248
// Filter time systems to only those with data tick
241249
// sources
242250
timeSystems = this.timeSystemsForSourceType(tickSourceType);
243-
timeSystem = timeSystems[0];
251+
252+
//Retain currently selected time system if available
253+
timeSystem = timeSystems.filter(function (t) {
254+
return t.metadata.key === $scope.timeSystemModel.selected.metadata.key;
255+
})[0];
256+
//Default to first available time system
257+
timeSystem = timeSystem || timeSystems[0];
258+
244259
newMode = new FollowMode(this.conductor, timeSystem, newModeKey);
245260
newMode.tickSource(this.selectTickSource(timeSystem, tickSourceType));
246261
break;

0 commit comments

Comments
 (0)