[Time Controller] Show only outermost controller

WTD-1515
This commit is contained in:
Victor Woeltjen 2015-09-03 11:44:11 -07:00
parent f74da6b935
commit b668fb58fb

View File

@ -34,7 +34,8 @@ define(
'height: ' + CONDUCTOR_HEIGHT + '">', 'height: ' + CONDUCTOR_HEIGHT + '">',
"<mct-include key=\"'time-controller'\"></mct-include>", "<mct-include key=\"'time-controller'\"></mct-include>",
'</div>' '</div>'
].join(''); ].join(''),
GLOBAL_SHOWING = false;
/** /**
* The ConductorRepresenter attaches the universal time conductor * The ConductorRepresenter attaches the universal time conductor
@ -64,11 +65,9 @@ define(
// 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) {
if (this.showing) { this.destroy();
this.destroy();
}
if (this.views.indexOf(representation) !== -1) { 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.conductorElement = this.conductorElement =
@ -77,11 +76,18 @@ define(
this.element.addClass('abs'); this.element.addClass('abs');
this.element.css('bottom', CONDUCTOR_HEIGHT); this.element.css('bottom', CONDUCTOR_HEIGHT);
this.showing = true; this.showing = true;
GLOBAL_SHOWING = true;
} }
}; };
// Respond to the destruction of the current representation. // Respond to the destruction of the current representation.
ConductorRepresenter.prototype.destroy = function destroy() { ConductorRepresenter.prototype.destroy = function destroy() {
// We may not have decided to show in the first place,
// so circumvent any unnecessary cleanup
if (!this.showing) {
return;
}
// Restore the original size of the mct-representation // Restore the original size of the mct-representation
if (!this.hadAbs) { if (!this.hadAbs) {
this.element.removeClass('abs'); this.element.removeClass('abs');
@ -101,6 +107,7 @@ define(
} }
this.showing = false; this.showing = false;
GLOBAL_SHOWING = false;
}; };
return ConductorRepresenter; return ConductorRepresenter;