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 @@ ...@@ -5,11 +5,12 @@
"main": "dist/gridstack.js", "main": "dist/gridstack.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/troolee/gridstack.js.git" "url": "git+https://github.com/gridstack/gridstack.js.git"
}, },
"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",
...@@ -24,9 +25,9 @@ ...@@ -24,9 +25,9 @@
], ],
"license": "MIT", "license": "MIT",
"bugs": { "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": { "dependencies": {
"jquery": "^3.1.0", "jquery": "^3.1.0",
"jquery-ui": "^1.12.0", "jquery-ui": "^1.12.0",
......
...@@ -1033,9 +1033,13 @@ ...@@ -1033,9 +1033,13 @@
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
if (height < minHeight) { var cssMinHeight = parseInt(this.container.css('min-height'));
height = minHeight; 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); this.container.attr('data-gs-current-height', height);
if (!this.opts.cellHeight) { if (!this.opts.cellHeight) {
......
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