diff --git a/platform/features/layout/bundle.json b/platform/features/layout/bundle.json index 18686ebc83..221dad1ca5 100644 --- a/platform/features/layout/bundle.json +++ b/platform/features/layout/bundle.json @@ -61,6 +61,12 @@ "depends": [ "$scope", "telemetrySubscriber", "telemetryFormatter" ] } ], + "templates": [ + { + "key": "fixed.telemetry", + "templateUrl": "templates/elements/telemetry.html" + } + ], "types": [ { "key": "layout", diff --git a/platform/features/layout/res/templates/fixed.html b/platform/features/layout/res/templates/fixed.html index f89b7171d7..5ebdccaf82 100644 --- a/platform/features/layout/res/templates/fixed.html +++ b/platform/features/layout/res/templates/fixed.html @@ -5,14 +5,16 @@
- + diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index b2efd53157..3899f40b4e 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -1,8 +1,8 @@ /*global define*/ define( - ['./LayoutDrag', './LayoutSelection', './FixedProxy'], - function (LayoutDrag, LayoutSelection, FixedProxy) { + ['./LayoutDrag', './LayoutSelection', './FixedProxy', './elements/ElementProxies'], + function (LayoutDrag, LayoutSelection, FixedProxy, ElementProxies) { "use strict"; var DEFAULT_DIMENSIONS = [ 2, 1 ], @@ -63,6 +63,7 @@ define( var id = telemetryObject && telemetryObject.getId(); if (id) { elementProxies.forEach(function (element) { + element.name = telemetryObject.getModel().name; element.value = telemetryFormatter.formatRangeValue( subscription.getRangeValue(telemetryObject) ); @@ -79,15 +80,17 @@ define( // Decorate an element for display function makeProxyElement(element) { - // var ElementProxy = ElementProxies[element.type], - // e = new ElementProxy(element); - // e.style = convertPosition(element); - element = Object.create(element); - // Provide a displayable position (convert from grid to px) - element.style = convertPosition(element); - // Template names are same as type names, presently - element.template = element.type; - return element; // TODO: Use proxy! + var ElementProxy = ElementProxies[element.type], + e = ElementProxy && new ElementProxy(element); + + if (e) { + // Provide a displayable position (convert from grid to px) + e.style = convertPosition(element); + // Template names are same as type names, presently + e.template = element.type; + } + + return e; } // Decorate elements in the current configuration @@ -205,6 +208,13 @@ define( getDecoratedElements: function () { return elementProxies; }, + /** + * Check if the element is currently selected. + * @returns {boolean} true if selected + */ + selected: function (element) { + return selection.selected(element); + }, /** * Set the active user selection in this view. * @param element the element to select