mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 07:38:15 +00:00
Independent time contexts follow upstream contexts as needed (#4556)
* Update independent time context APIs to follow upstream time contexts as necessary * Removes boilerplate from views.
This commit is contained in:
@ -112,13 +112,11 @@ export default {
|
||||
this.timeContext = this.openmct.time.getContextForView(this.objectPath);
|
||||
this.timeContext.on("timeSystem", this.setScaleAndPlotImagery);
|
||||
this.timeContext.on("bounds", this.updateViewBounds);
|
||||
this.timeContext.on("timeContext", this.setTimeContext);
|
||||
},
|
||||
stopFollowingTimeContext() {
|
||||
if (this.timeContext) {
|
||||
this.timeContext.off("timeSystem", this.setScaleAndPlotImagery);
|
||||
this.timeContext.off("bounds", this.updateViewBounds);
|
||||
this.timeContext.off("timeContext", this.setTimeContext);
|
||||
}
|
||||
},
|
||||
expand(index) {
|
||||
|
@ -501,13 +501,11 @@ export default {
|
||||
//listen
|
||||
this.timeContext.on('timeSystem', this.trackDuration);
|
||||
this.timeContext.on('clock', this.trackDuration);
|
||||
this.timeContext.on("timeContext", this.setTimeContext);
|
||||
},
|
||||
stopFollowingTimeContext() {
|
||||
if (this.timeContext) {
|
||||
this.timeContext.off("timeSystem", this.trackDuration);
|
||||
this.timeContext.off("clock", this.trackDuration);
|
||||
this.timeContext.off("timeContext", this.setTimeContext);
|
||||
}
|
||||
},
|
||||
boundsChange(bounds, isTick) {
|
||||
|
@ -62,13 +62,11 @@ export default {
|
||||
this.timeContext.on('bounds', this.boundsChange);
|
||||
this.boundsChange(this.timeContext.bounds());
|
||||
this.timeContext.on('timeSystem', this.timeSystemChange);
|
||||
this.timeContext.on("timeContext", this.setDataTimeContext);
|
||||
},
|
||||
stopFollowingDataTimeContext() {
|
||||
if (this.timeContext) {
|
||||
this.timeContext.off('bounds', this.boundsChange);
|
||||
this.timeContext.off('timeSystem', this.timeSystemChange);
|
||||
this.timeContext.off("timeContext", this.setDataTimeContext);
|
||||
}
|
||||
},
|
||||
datumIsNotValid(datum) {
|
||||
|
@ -120,7 +120,6 @@ export default {
|
||||
setTimeContext() {
|
||||
this.stopFollowingTimeContext();
|
||||
this.timeContext = this.openmct.time.getContextForView(this.path);
|
||||
this.timeContext.on("timeContext", this.setTimeContext);
|
||||
this.followTimeContext();
|
||||
},
|
||||
followTimeContext() {
|
||||
@ -133,7 +132,6 @@ export default {
|
||||
if (this.timeContext) {
|
||||
this.timeContext.off("timeSystem", this.setScaleAndPlotActivities);
|
||||
this.timeContext.off("bounds", this.updateViewBounds);
|
||||
this.timeContext.off("timeContext", this.setTimeContext);
|
||||
}
|
||||
},
|
||||
observeForChanges(mutatedObject) {
|
||||
|
@ -283,7 +283,6 @@ export default {
|
||||
this.stopFollowingTimeContext();
|
||||
|
||||
this.timeContext = this.openmct.time.getContextForView(this.path);
|
||||
this.timeContext.on('timeContext', this.setTimeContext);
|
||||
this.followTimeContext();
|
||||
|
||||
},
|
||||
@ -297,7 +296,6 @@ export default {
|
||||
if (this.timeContext) {
|
||||
this.timeContext.off("clock", this.updateRealTime);
|
||||
this.timeContext.off("bounds", this.updateDisplayBounds);
|
||||
this.timeContext.off("timeContext", this.setTimeContext);
|
||||
}
|
||||
},
|
||||
getConfig() {
|
||||
|
@ -110,7 +110,6 @@ export default {
|
||||
setTimeContext() {
|
||||
this.stopFollowingTimeContext();
|
||||
this.timeContext = this.openmct.time.getContextForView(this.keyString ? [{identifier: this.keyString}] : []);
|
||||
this.timeContext.on('timeContext', this.setTimeContext);
|
||||
|
||||
this.handleNewBounds(this.timeContext.bounds());
|
||||
this.timeContext.on('bounds', this.handleNewBounds);
|
||||
@ -120,7 +119,6 @@ export default {
|
||||
if (this.timeContext) {
|
||||
this.timeContext.off('bounds', this.handleNewBounds);
|
||||
this.timeContext.off('clock', this.clearAllValidation);
|
||||
this.timeContext.off('timeContext', this.setTimeContext);
|
||||
}
|
||||
},
|
||||
handleNewBounds(bounds) {
|
||||
|
@ -138,13 +138,11 @@ export default {
|
||||
this.timeContext.off('bounds', this.handleNewBounds);
|
||||
this.timeContext.off('clock', this.clearAllValidation);
|
||||
this.timeContext.off('clockOffsets', this.setViewFromOffsets);
|
||||
this.timeContext.off('timeContext', this.setTimeContext);
|
||||
}
|
||||
},
|
||||
setTimeContext() {
|
||||
this.stopFollowingTime();
|
||||
this.timeContext = this.openmct.time.getContextForView(this.keyString ? [{identifier: this.keyString}] : []);
|
||||
this.timeContext.on('timeContext', this.setTimeContext);
|
||||
this.followTime();
|
||||
},
|
||||
handleNewBounds(bounds) {
|
||||
|
@ -150,12 +150,10 @@ export default {
|
||||
setTimeContext() {
|
||||
this.stopFollowingTimeContext();
|
||||
this.timeContext = this.openmct.time.getContextForView([this.domainObject]);
|
||||
this.timeContext.on('timeContext', this.setTimeContext);
|
||||
this.timeContext.on('clock', this.setTimeOptions);
|
||||
},
|
||||
stopFollowingTimeContext() {
|
||||
if (this.timeContext) {
|
||||
this.timeContext.off('timeContext', this.setTimeContext);
|
||||
this.timeContext.off('clock', this.setTimeOptions);
|
||||
}
|
||||
},
|
||||
@ -212,7 +210,17 @@ export default {
|
||||
}
|
||||
|
||||
const key = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||
this.unregisterIndependentTime = this.openmct.time.addIndependentContext(key, offsets, this.isFixed ? undefined : this.mode.key);
|
||||
const timeContext = this.openmct.time.getIndependentContext(key);
|
||||
if (!timeContext.hasOwnContext()) {
|
||||
this.unregisterIndependentTime = this.openmct.time.addIndependentContext(key, offsets, this.isFixed ? undefined : this.mode.key);
|
||||
} else {
|
||||
if (this.isFixed) {
|
||||
timeContext.stopClock();
|
||||
timeContext.bounds(offsets);
|
||||
} else {
|
||||
timeContext.clock(this.mode.key, offsets);
|
||||
}
|
||||
}
|
||||
},
|
||||
destroyIndependentTime() {
|
||||
if (this.unregisterIndependentTime) {
|
||||
|
@ -161,14 +161,12 @@ export default {
|
||||
this.stopFollowingTimeContext();
|
||||
|
||||
this.timeContext = this.openmct.time.getContextForView(this.objectPath);
|
||||
this.timeContext.on('timeContext', this.setTimeContext);
|
||||
this.updateViewBounds(this.timeContext.bounds());
|
||||
this.timeContext.on('bounds', this.updateViewBounds);
|
||||
},
|
||||
stopFollowingTimeContext() {
|
||||
if (this.timeContext) {
|
||||
this.timeContext.off('bounds', this.updateViewBounds);
|
||||
this.timeContext.off('timeContext', this.setTimeContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user