set the plot's followed time context when independent time conductor is toggled on or off

This commit is contained in:
David Tsay 2024-12-09 18:15:36 -08:00
parent 5be103ea72
commit c18c0eb433

View File

@ -284,7 +284,7 @@ export default {
selectedXKeyOption: {}, selectedXKeyOption: {},
xKeyOptions: [], xKeyOptions: [],
pending: 0, pending: 0,
isRealTime: this.openmct.time.isRealTime(), isRealTime: undefined,
loaded: false, loaded: false,
isTimeOutOfSync: false, isTimeOutOfSync: false,
isFrozenOnMouseDown: false, isFrozenOnMouseDown: false,
@ -387,6 +387,11 @@ export default {
this.config.series.models.forEach(this.addSeries, this); this.config.series.models.forEach(this.addSeries, this);
this.independentTimeConductorObserver = this.openmct.objects.observe(
this.domainObject,
'configuration.useIndependentTime',
this.setTimeContext
);
this.filterObserver = this.openmct.objects.observe( this.filterObserver = this.openmct.objects.observe(
this.domainObject, this.domainObject,
'configuration.filters', 'configuration.filters',
@ -538,8 +543,11 @@ export default {
}, },
followTimeContext() { followTimeContext() {
this.updateDisplayBounds(this.timeContext.getBounds()); this.updateDisplayBounds(this.timeContext.getBounds());
this.updateMode();
this.timeContext.on('modeChanged', this.updateMode); this.timeContext.on('modeChanged', this.updateMode);
this.timeContext.on('boundsChanged', this.updateDisplayBounds); this.timeContext.on('boundsChanged', this.updateDisplayBounds);
this.synchronized(true); this.synchronized(true);
}, },
stopFollowingTimeContext() { stopFollowingTimeContext() {
@ -824,13 +832,11 @@ export default {
* displays can update accordingly. * displays can update accordingly.
*/ */
synchronized(value) { synchronized(value) {
const isRealTime = this.timeContext.isRealTime();
if (typeof value !== 'undefined') { if (typeof value !== 'undefined') {
this._synchronized = value; this._synchronized = value;
this.isTimeOutOfSync = value !== true; this.isTimeOutOfSync = value !== true;
const isUnsynced = isRealTime && !value; const isUnsynced = this.isRealTime && !value;
this.setStatus(isUnsynced); this.setStatus(isUnsynced);
} }
@ -1794,8 +1800,7 @@ export default {
}, },
showSynchronizeDialog() { showSynchronizeDialog() {
const isFixedTimespanMode = this.timeContext.isFixed(); if (this.isRealTime) {
if (!isFixedTimespanMode) {
const message = ` const message = `
This action will change the Time Conductor to Fixed Timespan mode with this plot view's current time bounds. This action will change the Time Conductor to Fixed Timespan mode with this plot view's current time bounds.
Do you want to continue? Do you want to continue?
@ -1853,17 +1858,12 @@ export default {
delete this.checkForSize; delete this.checkForSize;
} }
if (this.filterObserver) { this.independentTimeConductorObserver?.();
this.filterObserver(); this.filterObserver?.();
}
if (this.removeStatusListener) { this.removeStatusListener?.();
this.removeStatusListener();
}
if (this.plotContainerResizeObserver) { this.plotContainerResizeObserver?.disconnect?.();
this.plotContainerResizeObserver.disconnect();
}
this.stopFollowingTimeContext(); this.stopFollowingTimeContext();
this.openmct.objectViews.off('clearData', this.clearData); this.openmct.objectViews.off('clearData', this.clearData);