mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 14:07:50 +00:00
Migrated TOI functionality to common controller
This commit is contained in:
parent
6bea6b3bc2
commit
7a09bc1339
@ -26,6 +26,7 @@ define([
|
||||
"./src/TimeConductor",
|
||||
"./src/ui/ConductorAxisController",
|
||||
"./src/ui/ConductorTOIController",
|
||||
"./src/ui/TimeOfInterestController",
|
||||
"./src/ui/MctConductorAxis",
|
||||
"./src/ui/NumberFormat",
|
||||
"text!./res/templates/time-conductor.html",
|
||||
@ -39,6 +40,7 @@ define([
|
||||
TimeConductor,
|
||||
ConductorAxisController,
|
||||
ConductorTOIController,
|
||||
TimeOfInterestController,
|
||||
MCTConductorAxis,
|
||||
NumberFormat,
|
||||
timeConductorTemplate,
|
||||
@ -95,6 +97,15 @@ define([
|
||||
"timeConductorViewService",
|
||||
"formatService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "TimeOfInterestController",
|
||||
"implementation": TimeOfInterestController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"timeConductor",
|
||||
"formatService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"directives": [
|
||||
|
@ -89,7 +89,10 @@
|
||||
ng-click="toi.click($event)">
|
||||
<a class="l-page-button s-icon-button icon-pointer-left"></a>
|
||||
<div class="l-data-visualization">
|
||||
<mct-include key="'time-of-interest'" class="show-val"></mct-include>
|
||||
<div style="position: relative; height: 100%" ng-style="{'left': toi.left + '%'}">
|
||||
<mct-include key="'time-of-interest'" class="show-val"
|
||||
parameters = "{'name': 'conductor'}"></mct-include>
|
||||
</div>
|
||||
</div>
|
||||
<a class="l-page-button align-right s-icon-button icon-pointer-right"></a>
|
||||
</div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="l-toi-holder"
|
||||
ng-class="{ 'pinned': toi.pinned, 'val-to-left': toi.left > 80 }"
|
||||
ng-style="{'left': toi.left + '%'}">
|
||||
ng-controller="TimeOfInterestController as toi"
|
||||
ng-class="{ 'pinned': pinned, 'val-to-left': toi.left > 80 }">
|
||||
<div class="l-flex-row l-toi">
|
||||
<span class="flex-elem l-flex-row l-toi-buttons">
|
||||
<a class="flex-elem t-button-resync icon-button" title="Re-sync Time of Interest"
|
||||
|
@ -29,11 +29,9 @@ define(
|
||||
* labelled 'ticks'. It requires 'start' and 'end' integer values to
|
||||
* be specified as attributes.
|
||||
*/
|
||||
function ConductorTOIController($scope, conductor, conductorViewService, formatService) {
|
||||
function ConductorTOIController($scope, conductor, conductorViewService) {
|
||||
this.conductor = conductor;
|
||||
this.conductorViewService = conductorViewService;
|
||||
this.formatService = formatService;
|
||||
this.toiText = undefined;
|
||||
|
||||
//Bind all class functions to 'this'
|
||||
Object.keys(ConductorTOIController.prototype).filter(function (key) {
|
||||
@ -46,9 +44,6 @@ define(
|
||||
this.conductorViewService.on('zoom', this.setOffsetFromBounds);
|
||||
this.conductorViewService.on('pan', this.setOffsetFromBounds);
|
||||
this.conductor.on('timeSystem', this.changeTimeSystem);
|
||||
if (conductor.timeSystem()) {
|
||||
this.changeTimeSystem(conductor.timeSystem());
|
||||
}
|
||||
|
||||
$scope.$on('$destroy', this.destroy);
|
||||
|
||||
@ -66,18 +61,12 @@ define(
|
||||
var offset = toi - bounds.start;
|
||||
var duration = bounds.end - bounds.start;
|
||||
this.left = offset / duration * 100;
|
||||
this.toiText = this.format.format(toi);
|
||||
};
|
||||
|
||||
ConductorTOIController.prototype.changeTimeSystem = function (timeSystem) {
|
||||
this.format = this.formatService.getFormat(timeSystem.formats()[0]);
|
||||
};
|
||||
|
||||
ConductorTOIController.prototype.changeTimeOfInterest = function () {
|
||||
var bounds = this.conductor.bounds();
|
||||
if (bounds) {
|
||||
this.setOffsetFromBounds(bounds);
|
||||
this.pinned = this.conductor.timeOfInterest() !== undefined;
|
||||
}
|
||||
};
|
||||
|
||||
@ -94,14 +83,6 @@ define(
|
||||
}
|
||||
};
|
||||
|
||||
ConductorTOIController.prototype.dismiss = function () {
|
||||
this.conductor.timeOfInterest(undefined);
|
||||
};
|
||||
|
||||
ConductorTOIController.prototype.resize = function () {
|
||||
//Do something?
|
||||
};
|
||||
|
||||
return ConductorTOIController;
|
||||
}
|
||||
);
|
||||
|
@ -34,6 +34,7 @@ define(
|
||||
this.formatService = formatService;
|
||||
this.format = undefined;
|
||||
this.toiText = undefined;
|
||||
this.$scope = $scope;
|
||||
|
||||
//Bind all class functions to 'this'
|
||||
Object.keys(TimeOfInterestController.prototype).filter(function (key) {
|
||||
@ -42,18 +43,22 @@ define(
|
||||
this[key] = TimeOfInterestController.prototype[key].bind(this);
|
||||
}.bind(this));
|
||||
|
||||
this.conductor.on('timeOfInterest', this.changeTimeOfInterest);
|
||||
this.conductor.on('timeSystem', this.changeTimeSystem);
|
||||
conductor.on('timeOfInterest', this.changeTimeOfInterest);
|
||||
conductor.on('timeSystem', this.changeTimeSystem);
|
||||
if (conductor.timeSystem()) {
|
||||
this.changeTimeSystem(conductor.timeSystem());
|
||||
}
|
||||
|
||||
$scope.$on('$destroy', this.destroy);
|
||||
|
||||
}
|
||||
|
||||
TimeOfInterestController.prototype.changeTimeOfInterest = function (toi) {
|
||||
this.pinned = (toi !== undefined);
|
||||
if (toi !== undefined) {
|
||||
this.$scope.pinned = true;
|
||||
this.toiText = this.format.format(toi);
|
||||
} else {
|
||||
this.$scope.pinned = false;
|
||||
}
|
||||
};
|
||||
|
||||
TimeOfInterestController.prototype.changeTimeSystem = function (timeSystem) {
|
||||
@ -61,10 +66,17 @@ define(
|
||||
};
|
||||
|
||||
TimeOfInterestController.prototype.destroy = function () {
|
||||
this.conductor.off('timeOfInterest', this.setOffsetFromBounds);
|
||||
this.conductor.off('timeOfInterest', this.changeTimeOfInterest);
|
||||
this.conductor.off('timeSystem', this.changeTimeSystem);
|
||||
};
|
||||
|
||||
TimeOfInterestController.prototype.dismiss = function () {
|
||||
this.conductor.timeOfInterest(undefined);
|
||||
};
|
||||
|
||||
TimeOfInterestController.prototype.resync = function () {
|
||||
this.conductor.timeOfInterest(this.conductor.timeOfInterest());
|
||||
};
|
||||
|
||||
return TimeOfInterestController;
|
||||
}
|
||||
|
@ -71,7 +71,9 @@
|
||||
</div>
|
||||
|
||||
<div class="gl-plot-wrapper-display-area-and-x-axis">
|
||||
<mct-include key="'time-of-interest'" class="show-val"></mct-include>
|
||||
<mct-include key="'time-of-interest'" class="show-val"
|
||||
parameters = "{'name': 'plot'}"
|
||||
></mct-include>
|
||||
|
||||
<div class="gl-plot-coords"
|
||||
ng-if="subplot.isHovering() && subplot.getHoverCoordinates()">
|
||||
|
Loading…
Reference in New Issue
Block a user