diff --git a/example/localTimeSystem/src/LADTickSource.js b/example/localTimeSystem/src/LADTickSource.js index e389d91621c..1497782eb77 100644 --- a/example/localTimeSystem/src/LADTickSource.js +++ b/example/localTimeSystem/src/LADTickSource.js @@ -38,16 +38,6 @@ define(['../../../platform/features/conductor-v2/conductor/src/timeSystems/Local } LADTickSource.prototype = Object.create(LocalClock.prototype); - LADTickSource.prototype.tick = function () { - console.log('data tick'); - var now = Date.now(); - this.listeners.forEach(function (listener){ - listener(now); - }); - this.timeoutHandle = this.$timeout(this.tick.bind(this), this.period); - }; - - LADTickSource.prototype.type = function () { return 'data'; }; diff --git a/example/localTimeSystem/src/LocalTimeSystem.js b/example/localTimeSystem/src/LocalTimeSystem.js index 6693d090cab..608fc8cbc80 100644 --- a/example/localTimeSystem/src/LocalTimeSystem.js +++ b/example/localTimeSystem/src/LocalTimeSystem.js @@ -26,6 +26,7 @@ define([ './LADTickSource' ], function (TimeSystem, LocalClock, LADTickSource) { var FIFTEEN_MINUTES = 15 * 60 * 1000, + THIRTY_MINUTES = 30 * 60 * 1000, DEFAULT_PERIOD = 1000; /** @@ -71,8 +72,16 @@ define([ { key: 'local-default', name: 'Local 12 hour time system defaults', + mode: 'fixed', deltas: {start: FIFTEEN_MINUTES, end: 0}, bounds: {start: now - FIFTEEN_MINUTES, end: now} + }, + { + key: 'local-default', + name: 'Local 12 hour time system defaults', + mode: 'follow', + deltas: {start: THIRTY_MINUTES, end: 0}, + bounds: {start: now - THIRTY_MINUTES, end: now} } ]; }; diff --git a/platform/features/conductor-v2/conductor/src/timeSystems/LocalClock.js b/platform/features/conductor-v2/conductor/src/timeSystems/LocalClock.js index aafec72017f..80e36b4265a 100644 --- a/platform/features/conductor-v2/conductor/src/timeSystems/LocalClock.js +++ b/platform/features/conductor-v2/conductor/src/timeSystems/LocalClock.js @@ -54,7 +54,6 @@ define(['./TickSource'], function (TickSource) { }; LocalClock.prototype.tick = function () { - console.log('clock tick'); var now = Date.now(); this.listeners.forEach(function (listener){ listener(now); diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js index 0e5c6e07598..ee7b2dc9591 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js @@ -253,8 +253,8 @@ define( /** * @private */ - TimeConductorController.prototype.setDeltasFromTimeSystem = function (timeSystem) { - var defaults = timeSystem.defaults()[0]; + TimeConductorController.prototype.setDeltasFromMode = function (mode) { + var defaults = mode.defaults(); var deltas = defaults.deltas; /* @@ -295,7 +295,7 @@ define( this.$scope.timeSystemModel.deltaFormat = newTimeSystem.deltaFormat(); var mode = this.conductorService.mode(); mode.timeSystem(newTimeSystem); - this.setDeltasFromTimeSystem(newTimeSystem); + this.setDeltasFromMode(mode); // If current mode supports ticking, set an appropriate tick // source from the new time system diff --git a/platform/features/conductor-v2/conductor/src/ui/modes/FixedMode.js b/platform/features/conductor-v2/conductor/src/ui/modes/FixedMode.js index f395c1456bc..2da9dd231aa 100644 --- a/platform/features/conductor-v2/conductor/src/ui/modes/FixedMode.js +++ b/platform/features/conductor-v2/conductor/src/ui/modes/FixedMode.js @@ -43,6 +43,16 @@ define( this.conductor.follow(false); }; + FixedMode.prototype.defaults = function () { + var timeSystem = this.timeSystem(); + + if (timeSystem){ + return timeSystem.defaults().filter(function (d) { + return d.mode === 'fixed'; + })[0]; + } + }; + /** * Defines behavior to occur when selected time system changes. In * this case, sets default bounds on the time conductor. @@ -53,7 +63,7 @@ define( TimeConductorMode.prototype.timeSystem.apply(this, arguments); if (timeSystem) { - var defaults = timeSystem.defaults()[0]; + var defaults = this.defaults(); var bounds = { start: defaults.bounds.start, diff --git a/platform/features/conductor-v2/conductor/src/ui/modes/FollowMode.js b/platform/features/conductor-v2/conductor/src/ui/modes/FollowMode.js index fb398c0674c..d249de61f9a 100644 --- a/platform/features/conductor-v2/conductor/src/ui/modes/FollowMode.js +++ b/platform/features/conductor-v2/conductor/src/ui/modes/FollowMode.js @@ -64,7 +64,7 @@ define( * Get or set tick source. Setting tick source will also start * listening to it and unlisten from any existing tick source * @param tickSource - * @returns {undefined|*} + * @returns {TickSource} */ FollowMode.prototype.tickSource = function (tickSource) { if (tickSource) { @@ -77,6 +77,16 @@ define( return this._tickSource; }; + FollowMode.prototype.defaults = function () { + var timeSystem = this.timeSystem(); + + if (timeSystem){ + return timeSystem.defaults().filter(function (d) { + return d.mode === 'follow'; + })[0]; + } + }; + /** * On time system change, default the bounds values in the time * conductor, using the deltas associated with this mode. @@ -87,7 +97,7 @@ define( TimeConductorMode.prototype.timeSystem.apply(this, arguments); if (timeSystem) { - var defaults = timeSystem.defaults()[0]; + var defaults = this.defaults(); if (arguments.length > 0) { var bounds = { diff --git a/platform/features/conductor-v2/conductor/src/ui/modes/TimeConductorMode.js b/platform/features/conductor-v2/conductor/src/ui/modes/TimeConductorMode.js index dfc683e4180..5b3211db6cb 100644 --- a/platform/features/conductor-v2/conductor/src/ui/modes/TimeConductorMode.js +++ b/platform/features/conductor-v2/conductor/src/ui/modes/TimeConductorMode.js @@ -62,6 +62,10 @@ define( return this._key; }; + TimeConductorMode.prototype.defaults = function () { + throw new Error("Not implemented"); + }; + TimeConductorMode.prototype.destroy = function () { }; diff --git a/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js b/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js index a968f1ca113..9338180ce1e 100644 --- a/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js +++ b/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js @@ -70,6 +70,14 @@ define([ { key: 'utc-default', name: 'UTC time system defaults', + mode: 'follow', + deltas: {start: FIFTEEN_MINUTES, end: 0}, + bounds: {start: now - FIFTEEN_MINUTES, end: now} + }, + { + key: 'utc-default', + name: 'UTC time system defaults', + mode: 'fixed', deltas: {start: FIFTEEN_MINUTES, end: 0}, bounds: {start: now - FIFTEEN_MINUTES, end: now} }