From b668fb58fbef2e8f2b4b54c82b50b94ed540d2f1 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 3 Sep 2015 11:44:11 -0700 Subject: [PATCH] [Time Controller] Show only outermost controller WTD-1515 --- .../conductor/src/ConductorRepresenter.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/platform/features/conductor/src/ConductorRepresenter.js b/platform/features/conductor/src/ConductorRepresenter.js index 5e68f2e2a4..5cbf1ce6e8 100644 --- a/platform/features/conductor/src/ConductorRepresenter.js +++ b/platform/features/conductor/src/ConductorRepresenter.js @@ -34,7 +34,8 @@ define( 'height: ' + CONDUCTOR_HEIGHT + '">', "", '' - ].join(''); + ].join(''), + GLOBAL_SHOWING = false; /** * The ConductorRepresenter attaches the universal time conductor @@ -64,11 +65,9 @@ define( // Handle a specific representation of a specific domain object 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 this.conductorScope(this.getScope().$new()); this.conductorElement = @@ -77,11 +76,18 @@ define( this.element.addClass('abs'); this.element.css('bottom', CONDUCTOR_HEIGHT); this.showing = true; + GLOBAL_SHOWING = true; } }; // Respond to the destruction of the current representation. 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 if (!this.hadAbs) { this.element.removeClass('abs'); @@ -101,6 +107,7 @@ define( } this.showing = false; + GLOBAL_SHOWING = false; }; return ConductorRepresenter;