mirror of
https://github.com/nasa/openmct.git
synced 2025-01-01 10:56:41 +00:00
[Fixed Position] Position elements where dropped
Position elements where they are dropped in Fixed Position view, WTD-877
This commit is contained in:
parent
ef4ed50605
commit
136dddab86
@ -147,6 +147,26 @@ define(
|
|||||||
telemetrySubscriber.subscribe(domainObject, updateValues);
|
telemetrySubscriber.subscribe(domainObject, updateValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Position a panel after a drop event
|
||||||
|
function handleDrop(e, id, position) {
|
||||||
|
// Make sure there is a "elements" field in the
|
||||||
|
// view configuration.
|
||||||
|
$scope.configuration.elements =
|
||||||
|
$scope.configuration.elements || {};
|
||||||
|
// Store the position of this element.
|
||||||
|
$scope.configuration.elements[id] = {
|
||||||
|
position: [
|
||||||
|
Math.floor(position.x / gridSize[0]),
|
||||||
|
Math.floor(position.y / gridSize[1])
|
||||||
|
],
|
||||||
|
dimensions: DEFAULT_DIMENSIONS
|
||||||
|
};
|
||||||
|
// Mark change as persistable
|
||||||
|
if ($scope.commit) {
|
||||||
|
$scope.commit("Dropped a frame.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Position panes when the model field changes
|
// Position panes when the model field changes
|
||||||
$scope.$watch("model", lookupPanels);
|
$scope.$watch("model", lookupPanels);
|
||||||
|
|
||||||
@ -156,6 +176,9 @@ define(
|
|||||||
// Free up subscription on destroy
|
// Free up subscription on destroy
|
||||||
$scope.$on("$destroy", releaseSubscription);
|
$scope.$on("$destroy", releaseSubscription);
|
||||||
|
|
||||||
|
// Position panes where they are dropped
|
||||||
|
$scope.$on("mctDrop", handleDrop);
|
||||||
|
|
||||||
// Initialize styles (position etc.) for cells
|
// Initialize styles (position etc.) for cells
|
||||||
refreshCellStyles();
|
refreshCellStyles();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user