[Fixed Position] Add proxy object

Add proxy object to represent the selection of the fixed position
view itself, WTD-879.
This commit is contained in:
Victor Woeltjen 2015-02-18 09:03:50 -08:00
parent 4be2a3f1cd
commit 97b844563d
2 changed files with 38 additions and 11 deletions

View File

@ -1,8 +1,8 @@
/*global define*/
define(
['./LayoutDrag'],
function (LayoutDrag) {
['./LayoutDrag', './LayoutSelection', './FixedProxy'],
function (LayoutDrag, LayoutSelection, FixedProxy) {
"use strict";
var DEFAULT_DIMENSIONS = [ 2, 1 ],
@ -26,7 +26,8 @@ define(
values = {},
cellStyles = [],
rawPositions = {},
positions = {};
positions = {},
selection;
// Utility function to copy raw positions from configuration,
// without writing directly to configuration (to avoid triggering
@ -179,6 +180,14 @@ define(
populatePosition(id);
}
// Track current selection state
if (Array.isArray($scope.selection)) {
selection = new LayoutSelection(
$scope.selection,
new FixedProxy($scope.configuration)
);
}
// Position panes when the model field changes
$scope.$watch("model.composition", updateComposition);
@ -194,14 +203,6 @@ define(
// Initialize styles (position etc.) for cells
refreshCellStyles();
if (Array.isArray($scope.selection)) {
$scope.selection.push({
add: function () {
window.alert("Placeholder; not yet implemented");
}
});
}
return {
/**
* Get styles for all background cells, as will populate the

View File

@ -0,0 +1,26 @@
/*global define*/
define(
[],
function () {
"use strict";
/**
* Proxy for configuring a fixed position view via the toolbar.
* @constructor
* @param configuration the view configuration object
*/
function FixedProxy(configuration) {
return {
/**
* Add a new visual element to this view.
*/
add: function (type) {
window.alert("Placeholder. Should add a " + type + ".");
}
};
}
return FixedProxy;
}
);