From 41a013d1987c4365eb61a5f2d76a78b7538fee62 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 23 Feb 2015 19:25:33 -0800 Subject: [PATCH] [Fixed Position] Add button to show/hide telemetry name Add button to show/hide name of telemetry elements in fixed position view, WTD-881. --- platform/features/layout/bundle.json | 12 +++++++++++ .../res/templates/elements/telemetry.html | 3 ++- .../features/layout/src/FixedController.js | 1 + .../layout/src/elements/TelemetryProxy.js | 21 +++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/platform/features/layout/bundle.json b/platform/features/layout/bundle.json index 3a3cf86c60..cd7426c04c 100644 --- a/platform/features/layout/bundle.json +++ b/platform/features/layout/bundle.json @@ -120,6 +120,18 @@ "name": "Text", "required": true } + }, + { + "method": "showTitle", + "glyph": "+", + "control": "button", + "description": "Show telemetry element title." + }, + { + "method": "hideTitle", + "glyph": "X", + "control": "button", + "description": "Hide telemetry element title." } ] }, diff --git a/platform/features/layout/res/templates/elements/telemetry.html b/platform/features/layout/res/templates/elements/telemetry.html index 8f8f44461f..3a40d416f8 100644 --- a/platform/features/layout/res/templates/elements/telemetry.html +++ b/platform/features/layout/res/templates/elements/telemetry.html @@ -1,6 +1,7 @@
-
+
{{ngModel.name}}
diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index 963afc8713..f795093dd4 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -195,6 +195,7 @@ define( id: id, stroke: "transparent", color: "#717171", + titled: true, width: DEFAULT_DIMENSIONS[0], height: DEFAULT_DIMENSIONS[1] }); diff --git a/platform/features/layout/src/elements/TelemetryProxy.js b/platform/features/layout/src/elements/TelemetryProxy.js index b587465df4..c358a4a480 100644 --- a/platform/features/layout/src/elements/TelemetryProxy.js +++ b/platform/features/layout/src/elements/TelemetryProxy.js @@ -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; }