[Fixed Position] Position elements where dropped

Position elements where they are dropped in Fixed Position
view, WTD-877
This commit is contained in:
Victor Woeltjen 2015-02-17 10:27:35 -08:00
parent ef4ed50605
commit 136dddab86

View File

@ -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();