mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +00:00
[Fixed Position] Update positions when grid size changes
Update positions of elements in a fixed position view when grid size changes (e.g. when switching from one domain object to another.) WTD-1344.
This commit is contained in:
parent
d3ff49b90b
commit
791504584d
@ -60,7 +60,7 @@ define(
|
||||
cellStyles = [];
|
||||
|
||||
// Update grid size from model
|
||||
gridSize = ($scope.model || {}).layoutGrid || gridSize;
|
||||
gridSize = ($scope.model || {}).layoutGrid || DEFAULT_GRID_SIZE;
|
||||
|
||||
for (x = 0; x < gridExtent[0]; x += 1) {
|
||||
for (y = 0; y < gridExtent[1]; y += 1) {
|
||||
@ -136,6 +136,16 @@ define(
|
||||
}
|
||||
}
|
||||
|
||||
// Update element positions when grid size changes
|
||||
function updateElementPositions(layoutGrid) {
|
||||
// Update grid size from model
|
||||
gridSize = layoutGrid || DEFAULT_GRID_SIZE;
|
||||
|
||||
elementProxies.forEach(function (elementProxy) {
|
||||
elementProxy.style = convertPosition(elementProxy);
|
||||
});
|
||||
}
|
||||
|
||||
// Update telemetry values based on new data available
|
||||
function updateValues() {
|
||||
if (subscription) {
|
||||
@ -277,6 +287,9 @@ define(
|
||||
// Position panes when the model field changes
|
||||
$scope.$watch("model.composition", updateComposition);
|
||||
|
||||
// Detect changes to grid size
|
||||
$scope.$watch("model.layoutGrid", updateElementPositions);
|
||||
|
||||
// Subscribe to telemetry when an object is available
|
||||
$scope.$watch("domainObject", subscribe);
|
||||
|
||||
@ -372,4 +385,4 @@ define(
|
||||
|
||||
return FixedController;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user