Always have at least one column

This commit is contained in:
Thomas Lovén 2019-03-11 19:40:33 +01:00
parent 5ef29f02f9
commit 226f86debe

View File

@ -80,7 +80,7 @@ class LayoutCard extends cardTools.LitElement {
update_columns() {
const width = (this.shadowRoot && this.shadowRoot.querySelector("#columns").clientWidth) || (this.parentElement && this.parentElement.clientWidth);
this.colNum = Math.floor(width / this.colWidth);
this.colNum = Math.floor(width / this.colWidth) || 1;
this.colNum = Math.max(this.colNum, this.minCols);
this.colNum = Math.min(this.colNum, this.maxCols);
}