Skip to content

Commit

Permalink
Really fix #40.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasloven committed Jan 3, 2020
1 parent 2598e5d commit fdc397e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion layout-card.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ class LayoutCard extends LitElement {
|| (this._config.cards && this._config.cards.length))
) {
// Build cards and layout
const width = this.clientWidth;
this.cards = await this.build_cards();
this.place_cards();
this.place_cards(width);
}

if(changedproperties.has("hass") && this.hass && this.cards) {
Expand Down Expand Up @@ -90,14 +91,12 @@ class LayoutCard extends LitElement {
);
}

place_cards() {
place_cards(width) {
if(this._config.layout === "grid")
return;
const width = this.shadowRoot.querySelector("#columns").clientWidth;

this.columns = buildLayout(
this.cards,
width,
width || 1,
this._config
);

Expand Down Expand Up @@ -235,4 +234,4 @@ class LayoutCard extends LitElement {

}

customElements.define("layout-card", LayoutCard);
customElements.define("layout-card", LayoutCard);

0 comments on commit fdc397e

Please sign in to comment.