[Fixed Position] Add button to show/hide telemetry name

Add button to show/hide name of telemetry elements in
fixed position view, WTD-881.
This commit is contained in:
Victor Woeltjen
2015-02-23 19:25:33 -08:00
parent 1c69d1f2da
commit 41a013d198
4 changed files with 36 additions and 1 deletions

View File

@ -5,6 +5,9 @@ define(
function (TextProxy, AccessorMutator) {
'use strict';
// Method names to expose from this proxy
var HIDE = 'hideTitle', SHOW = 'showTitle';
/**
* Selection proxy for telemetry elements in a fixed position view.
*
@ -20,9 +23,27 @@ define(
function TelemetryProxy(element, index, elements) {
var proxy = new TextProxy(element, index, elements);
// Toggle the visibility of the title
function toggle() {
// Toggle the state
element.titled = !element.titled;
// Change which method is exposed, to influence
// which button is shown in the toolbar
delete proxy[SHOW];
delete proxy[HIDE];
proxy[element.titled ? HIDE : SHOW] = toggle;
}
// Expose the domain object identifier
proxy.id = element.id;
// Expose initial toggle
proxy[element.titled ? HIDE : SHOW] = toggle;
// Don't expose text configuration
delete proxy.text;
return proxy;
}