Commit caffe028 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 030d1c5e
......@@ -5,11 +5,12 @@
"main": "dist/gridstack.js",
"repository": {
"type": "git",
"url": "git+https://github.com/troolee/gridstack.js.git"
"url": "git+https://github.com/gridstack/gridstack.js.git"
},
"scripts": {
"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": [
"gridstack",
......@@ -24,9 +25,9 @@
],
"license": "MIT",
"bugs": {
"url": "https://github.com/troolee/gridstack.js/issues"
"url": "https://github.com/gridstack/gridstack.js/issues"
},
"homepage": "http://troolee.github.io/gridstack.js/",
"homepage": "http://gridstack.github.io/gridstack.js/",
"dependencies": {
"jquery": "^3.1.0",
"jquery-ui": "^1.12.0",
......
......@@ -1033,10 +1033,14 @@
return;
}
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) {
height = minHeight;
}
}
this.container.attr('data-gs-current-height', height);
if (!this.opts.cellHeight) {
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