diff --git a/platform/features/fixed/bundle.js b/platform/features/fixed/bundle.js index e2e40ff511..9f98750178 100644 --- a/platform/features/fixed/bundle.js +++ b/platform/features/fixed/bundle.js @@ -204,6 +204,7 @@ define([ } ], "model": { + "layoutGrid": [64, 16], "composition": [] }, "properties": [ diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index 42c9565a68..e5345cb46a 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -24,8 +24,7 @@ define( ['./FixedProxy', './elements/ElementProxies', './FixedDragHandle'], function (FixedProxy, ElementProxies, FixedDragHandle) { - var DEFAULT_DIMENSIONS = [2, 1], - DEFAULT_GRID_SIZE = [64, 16]; + var DEFAULT_DIMENSIONS = [2, 1]; /** * The FixedController is responsible for supporting the @@ -132,7 +131,7 @@ define( // Update element positions when grid size changes function updateElementPositions(layoutGrid) { // Update grid size from model - self.gridSize = layoutGrid || DEFAULT_GRID_SIZE; + self.gridSize = layoutGrid; self.elementProxies.forEach(function (elementProxy) { elementProxy.style = convertPosition(elementProxy); @@ -293,7 +292,6 @@ define( }); } - this.gridSize = DEFAULT_GRID_SIZE; this.elementProxies = []; this.generateDragHandle = generateDragHandle; this.generateDragHandles = generateDragHandles; @@ -310,15 +308,15 @@ define( } }.bind(this)); + // Detect changes to grid size + $scope.$watch("model.layoutGrid", updateElementPositions); + // Refresh list of elements whenever model changes $scope.$watch("model.modified", refreshElements); // 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); diff --git a/platform/features/layout/test/FixedControllerSpec.js b/platform/features/layout/test/FixedControllerSpec.js index 12b1b63b55..190658b4f9 100644 --- a/platform/features/layout/test/FixedControllerSpec.js +++ b/platform/features/layout/test/FixedControllerSpec.js @@ -147,6 +147,7 @@ define( mockFormatter ); + findWatch("model.layoutGrid")(testModel.layoutGrid); findWatch("selection")(mockScope.selection); });