mirror of
https://github.com/nasa/openmct.git
synced 2025-01-04 12:24:10 +00:00
[Time Controller] Bind displayed control to state
Bind changes to the displayed time controller to changes to the underlying state of the time conductor, WTD-1515.
This commit is contained in:
parent
dbfb8b9861
commit
bf4765fcb6
@ -3,7 +3,20 @@
|
|||||||
"representers": [
|
"representers": [
|
||||||
{
|
{
|
||||||
"implementation": "ConductorRepresenter.js",
|
"implementation": "ConductorRepresenter.js",
|
||||||
"depends": [ "$compile", "views[]" ]
|
"depends": [ "conductorService", "$compile", "views[]" ]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"implementation": "ConductorCapabilityDecorator.js",
|
||||||
|
"depends": [ "conductorService" ]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": [
|
||||||
|
{
|
||||||
|
"key": "conductorService",
|
||||||
|
"implementation": "ConductorService.js",
|
||||||
|
"depends": [ "now" ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,8 @@ define(
|
|||||||
'"position: absolute; bottom: 0; width: 100%; ',
|
'"position: absolute; bottom: 0; width: 100%; ',
|
||||||
'overflow: hidden; ',
|
'overflow: hidden; ',
|
||||||
'height: ' + CONDUCTOR_HEIGHT + '">',
|
'height: ' + CONDUCTOR_HEIGHT + '">',
|
||||||
"<mct-include key=\"'time-controller'\"></mct-include>",
|
"<mct-include key=\"'time-controller'\" ng-model='conductor'>",
|
||||||
|
"</mct-include>",
|
||||||
'</div>'
|
'</div>'
|
||||||
].join(''),
|
].join(''),
|
||||||
GLOBAL_SHOWING = false;
|
GLOBAL_SHOWING = false;
|
||||||
@ -45,7 +46,7 @@ define(
|
|||||||
* @implements {Representer}
|
* @implements {Representer}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function ConductorRepresenter($compile, views, scope, element) {
|
function ConductorRepresenter(conductorService, $compile, views, scope, element) {
|
||||||
var conductorScope;
|
var conductorScope;
|
||||||
|
|
||||||
// Angular doesn't like objects to retain references to scope
|
// Angular doesn't like objects to retain references to scope
|
||||||
@ -54,6 +55,7 @@ define(
|
|||||||
return (conductorScope = arguments.length > 0 ? s : conductorScope);
|
return (conductorScope = arguments.length > 0 ? s : conductorScope);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.conductorService = conductorService;
|
||||||
this.element = element;
|
this.element = element;
|
||||||
this.showing = false;
|
this.showing = false;
|
||||||
this.views = views;
|
this.views = views;
|
||||||
@ -63,6 +65,29 @@ define(
|
|||||||
this.hadAbs = element.hasClass('abs');
|
this.hadAbs = element.hasClass('abs');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the time conductor from the scope
|
||||||
|
ConductorRepresenter.prototype.wireScope = function () {
|
||||||
|
var scope = this.conductorScope(),
|
||||||
|
conductor = this.conductorService.getConductor();
|
||||||
|
|
||||||
|
function updateConductor() {
|
||||||
|
conductor.queryStart(scope.conductor.outer[0]);
|
||||||
|
conductor.queryEnd(scope.conductor.outer[1]);
|
||||||
|
conductor.displayStart(scope.conductor.inner[0]);
|
||||||
|
conductor.displayEnd(scope.conductor.inner[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
scope.conductor = {
|
||||||
|
outer: [ conductor.queryStart(), conductor.queryEnd() ],
|
||||||
|
inner: [ conductor.displayStart(), conductor.displayEnd() ]
|
||||||
|
};
|
||||||
|
|
||||||
|
scope.$watch('conductor.outer[0]', updateConductor);
|
||||||
|
scope.$watch('conductor.outer[1]', updateConductor);
|
||||||
|
scope.$watch('conductor.inner[0]', updateConductor);
|
||||||
|
scope.$watch('conductor.inner[1]', updateConductor);
|
||||||
|
};
|
||||||
|
|
||||||
// Handle a specific representation of a specific domain object
|
// Handle a specific representation of a specific domain object
|
||||||
ConductorRepresenter.prototype.represent = function represent(representation, representedObject) {
|
ConductorRepresenter.prototype.represent = function represent(representation, representedObject) {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
@ -70,6 +95,7 @@ define(
|
|||||||
if (this.views.indexOf(representation) !== -1 && !GLOBAL_SHOWING) {
|
if (this.views.indexOf(representation) !== -1 && !GLOBAL_SHOWING) {
|
||||||
// Create a new scope for the conductor
|
// Create a new scope for the conductor
|
||||||
this.conductorScope(this.getScope().$new());
|
this.conductorScope(this.getScope().$new());
|
||||||
|
this.wireScope();
|
||||||
this.conductorElement =
|
this.conductorElement =
|
||||||
this.$compile(TEMPLATE)(this.conductorScope());
|
this.$compile(TEMPLATE)(this.conductorScope());
|
||||||
this.element.after(this.conductorElement[0]);
|
this.element.after(this.conductorElement[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user