mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 15:43:48 +00:00
[Fixed Position] Begin using proxies
Begin using proxies for elements in fixed position view, WTD-879.
This commit is contained in:
@ -61,6 +61,12 @@
|
|||||||
"depends": [ "$scope", "telemetrySubscriber", "telemetryFormatter" ]
|
"depends": [ "$scope", "telemetrySubscriber", "telemetryFormatter" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"templates": [
|
||||||
|
{
|
||||||
|
"key": "fixed.telemetry",
|
||||||
|
"templateUrl": "templates/elements/telemetry.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"key": "layout",
|
"key": "layout",
|
||||||
|
@ -5,14 +5,16 @@
|
|||||||
<!-- Background grid -->
|
<!-- Background grid -->
|
||||||
<div ng-repeat="cell in controller.getCellStyles()"
|
<div ng-repeat="cell in controller.getCellStyles()"
|
||||||
style="position: absolute; border: 1px gray solid; background: black;"
|
style="position: absolute; border: 1px gray solid; background: black;"
|
||||||
|
ng-click="controller.deselect()"
|
||||||
ng-style="cell">
|
ng-style="cell">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Telemetry elements -->
|
<!-- Fixed position elements -->
|
||||||
<mct-include ng-repeat="element in controller.getDecoratedElements()"
|
<mct-include ng-repeat="element in controller.getDecoratedElements()"
|
||||||
style="position: absolute;"
|
style="position: absolute;"
|
||||||
ng-style="element.style"
|
|
||||||
key="element.template"
|
key="element.template"
|
||||||
|
ng-style="element.style"
|
||||||
|
ng-click="controller.select(element)"
|
||||||
ng-model="element">
|
ng-model="element">
|
||||||
</mct-include>
|
</mct-include>
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*global define*/
|
/*global define*/
|
||||||
|
|
||||||
define(
|
define(
|
||||||
['./LayoutDrag', './LayoutSelection', './FixedProxy'],
|
['./LayoutDrag', './LayoutSelection', './FixedProxy', './elements/ElementProxies'],
|
||||||
function (LayoutDrag, LayoutSelection, FixedProxy) {
|
function (LayoutDrag, LayoutSelection, FixedProxy, ElementProxies) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var DEFAULT_DIMENSIONS = [ 2, 1 ],
|
var DEFAULT_DIMENSIONS = [ 2, 1 ],
|
||||||
@ -63,6 +63,7 @@ define(
|
|||||||
var id = telemetryObject && telemetryObject.getId();
|
var id = telemetryObject && telemetryObject.getId();
|
||||||
if (id) {
|
if (id) {
|
||||||
elementProxies.forEach(function (element) {
|
elementProxies.forEach(function (element) {
|
||||||
|
element.name = telemetryObject.getModel().name;
|
||||||
element.value = telemetryFormatter.formatRangeValue(
|
element.value = telemetryFormatter.formatRangeValue(
|
||||||
subscription.getRangeValue(telemetryObject)
|
subscription.getRangeValue(telemetryObject)
|
||||||
);
|
);
|
||||||
@ -79,15 +80,17 @@ define(
|
|||||||
|
|
||||||
// Decorate an element for display
|
// Decorate an element for display
|
||||||
function makeProxyElement(element) {
|
function makeProxyElement(element) {
|
||||||
// var ElementProxy = ElementProxies[element.type],
|
var ElementProxy = ElementProxies[element.type],
|
||||||
// e = new ElementProxy(element);
|
e = ElementProxy && new ElementProxy(element);
|
||||||
// e.style = convertPosition(element);
|
|
||||||
element = Object.create(element);
|
if (e) {
|
||||||
// Provide a displayable position (convert from grid to px)
|
// Provide a displayable position (convert from grid to px)
|
||||||
element.style = convertPosition(element);
|
e.style = convertPosition(element);
|
||||||
// Template names are same as type names, presently
|
// Template names are same as type names, presently
|
||||||
element.template = element.type;
|
e.template = element.type;
|
||||||
return element; // TODO: Use proxy!
|
}
|
||||||
|
|
||||||
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decorate elements in the current configuration
|
// Decorate elements in the current configuration
|
||||||
@ -205,6 +208,13 @@ define(
|
|||||||
getDecoratedElements: function () {
|
getDecoratedElements: function () {
|
||||||
return elementProxies;
|
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.
|
* Set the active user selection in this view.
|
||||||
* @param element the element to select
|
* @param element the element to select
|
||||||
|
Reference in New Issue
Block a user