Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Commit

Permalink
fix(uiLayout): resize layout on window resize
Browse files Browse the repository at this point in the history
This change will reset the size of the layout when a window resize occurs to ensure the layout fits within the new window constraints.

Resolves #47
  • Loading branch information
jbro-io committed Nov 10, 2014
1 parent 8d2c4c0 commit a31c3ed
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/ui-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ angular.module('ui.layout', [])

c.collapsed = c.collapsed || opts.collapsed[i];

//TODO: adjust size if autosize is greater than the maxSize

if(!LayoutContainer.isSplitbar(c)) {
var newSize = (opts.sizes[i] === 'auto') ? autoSize : opts.sizes[i];

Expand Down Expand Up @@ -418,15 +420,20 @@ angular.module('ui.layout', [])
return ctrl;
}])

.directive('uiLayout', function() {
.directive('uiLayout', function($window) {
return {
restrict: 'AE',
controller: 'uiLayoutCtrl',

link: function(scope, element, attrs, ctrl) {
scope.$watch(element[0][ctrl.sizeProperties.offsetName], function() {
ctrl.updateDisplay();
});

angular.element($window).bind('resize', function() {
scope.$apply(function() {
ctrl.updateDisplay();
});
});
}
};
})
Expand Down

0 comments on commit a31c3ed

Please sign in to comment.