diff --git a/ui/src/app/components/dashboard.directive.js b/ui/src/app/components/dashboard.directive.js
index cdd15b0..9350dac 100644
--- a/ui/src/app/components/dashboard.directive.js
+++ b/ui/src/app/components/dashboard.directive.js
@@ -356,6 +356,7 @@ function DashboardController($scope, $rootScope, $element, $timeout, $mdMedia, $
var margins = vm.margins ? vm.margins : [10, 10];
if (!angular.equals(vm.gridsterOpts.margins, margins)) {
vm.gridsterOpts.margins = margins;
+ updateMobileOpts();
if (vm.gridster) {
vm.gridster.margins = vm.margins;
updateGridsterParams();
@@ -413,7 +414,7 @@ function DashboardController($scope, $rootScope, $element, $timeout, $mdMedia, $
var sizeY = widgetSizeY(w);
totalRows += sizeY;
}
- rowHeight = (viewportHeight - (vm.gridsterOpts.margins[1])) / totalRows;
+ rowHeight = (viewportHeight - vm.gridsterOpts.margins[1]*(vm.widgets.length+1) + vm.gridsterOpts.margins[0]*vm.widgets.length) / totalRows;
}
return rowHeight;
}