Commit 68932d65 authored by adumesny's avatar adumesny
Browse files

use verticalMargin when calculating min height in rows

Testing:
1. run two.html and check that yellow grid has height of 300px
2. modify two.html to have
#grid1 {
  background: lightgoldenrodyellow;
   min-height: 300px;
}
3. rerun and notice grid1 now has 380px actual height (passed last item) !
4. adding removing items will shrink grow, but not to the correct min 300px size.
parent 5b7af403
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
}, },
"scripts": { "scripts": {
"build": "grunt ; doctoc ./README.md ; doctoc ./doc/README.md ; doctoc ./doc/CHANGES.md", "build": "grunt ; doctoc ./README.md ; doctoc ./doc/README.md ; doctoc ./doc/CHANGES.md",
"test": "grunt lint && karma start karma.conf.js" "test": "grunt lint && karma start karma.conf.js",
"lint": "grunt lint"
}, },
"keywords": [ "keywords": [
"gridstack", "gridstack",
......
...@@ -1033,10 +1033,14 @@ ...@@ -1033,10 +1033,14 @@
return; return;
} }
var height = this.grid.getGridHeight(); var height = this.grid.getGridHeight();
var minHeight = parseInt(this.container.css('min-height')) / this.cellHeight(); // check for css min height. Each row is cellHeight + verticalMargin, until last one which has no margin below
var cssMinHeight = parseInt(this.container.css('min-height'));
if (cssMinHeight > 0) {
var minHeight = (cssMinHeight + this.opts.verticalMargin) / (this.cellHeight() + this.opts.verticalMargin);
if (height < minHeight) { if (height < minHeight) {
height = minHeight; height = minHeight;
} }
}
this.container.attr('data-gs-current-height', height); this.container.attr('data-gs-current-height', height);
if (!this.opts.cellHeight) { if (!this.opts.cellHeight) {
return ; return ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment