diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index 8e9fb5936e..afcf8b312e 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -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 diff --git a/platform/features/layout/src/FixedProxy.js b/platform/features/layout/src/FixedProxy.js new file mode 100644 index 0000000000..a6c1583cf7 --- /dev/null +++ b/platform/features/layout/src/FixedProxy.js @@ -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; + } +); \ No newline at end of file