[Time] Tick when clock set

Update time API to tick immediately after setting a clock using
the currentValue of the clock.  This ensures that bounds will
be set when the clock is set, instead of waiting for the next
tick to occur.

fixes https://github.com/nasa/openmct/issues/1582
This commit is contained in:
Pete Richards 2017-05-16 12:27:52 -07:00
parent eb7f78799d
commit 344a325cb5

View File

@ -366,11 +366,6 @@ define(['EventEmitter'], function (EventEmitter) {
this.activeClock = clock;
if (this.activeClock !== undefined) {
this.offsets = offsets;
this.activeClock.on("tick", this.tick);
}
/**
* The active clock has changed. Clock can be unset by calling {@link stopClock}
* @event clock
@ -380,6 +375,11 @@ define(['EventEmitter'], function (EventEmitter) {
*/
this.emit("clock", this.activeClock);
if (this.activeClock !== undefined) {
this.clockOffsets(offsets);
this.activeClock.on("tick", this.tick);
}
} else if (arguments.length === 1) {
throw "When setting the clock, clock offsets must also be provided";
}