Change some layout options. Mainly max_width and column_width. Read the readme

This commit is contained in:
2019-03-08 10:57:43 +01:00
parent 70a1986b64
commit 5ef29f02f9
2 changed files with 15 additions and 19 deletions

View File

@@ -80,10 +80,7 @@ class LayoutCard extends cardTools.LitElement {
update_columns() {
const width = (this.shadowRoot && this.shadowRoot.querySelector("#columns").clientWidth) || (this.parentElement && this.parentElement.clientWidth);
if(typeof(this.colWidth) === 'object')
this.colNum = this.colWidth.length;
else
this.colNum = Math.floor(width / this.colWidth);
this.colNum = Math.floor(width / this.colWidth);
this.colNum = Math.max(this.colNum, this.minCols);
this.colNum = Math.min(this.colNum, this.maxCols);
}
@@ -154,8 +151,8 @@ class LayoutCard extends cardTools.LitElement {
div.classList.add('column');
c.forEach((e) => div.appendChild(e));
root.appendChild(div);
if(typeof(this.colWidth) === 'object') {
div.style.setProperty('max-width', this.colWidth[i]);
if(cols.length > 1 && typeof(this.maxWidth) === 'object') {
div.style.setProperty('max-width', this.maxWidth[i]);
} else {
div.style.setProperty('max-width', this.maxWidth+'px');
}