From 128c37a8d6f6780b8f4103436775f56b2c00e0ea Mon Sep 17 00:00:00 2001 From: Ryan Meek Date: Mon, 20 May 2019 09:55:02 -0400 Subject: [PATCH 1/2] Prevent swipe animation on first/last tab if wrap is disabled. --- compact-custom-header.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/compact-custom-header.js b/compact-custom-header.js index aaa560a..88a4ef3 100644 --- a/compact-custom-header.js +++ b/compact-custom-header.js @@ -1,4 +1,4 @@ -import "./compact-custom-header-editor.js?v=1.0.4b4"; +import "./compact-custom-header-editor.js?v=1.0.4b5"; export const LitElement = Object.getPrototypeOf( customElements.get("ha-panel-lovelace") @@ -621,10 +621,14 @@ if (!customElements.get("compact-custom-header")) { hideTabs(tabContainer, tabs) { let hidden_tabs = String(this.cchConfig.hide_tabs).length - ? String(this.cchConfig.hide_tabs).replace(/\s+/g, "").split(",") + ? String(this.cchConfig.hide_tabs) + .replace(/\s+/g, "") + .split(",") : null; let shown_tabs = String(this.cchConfig.show_tabs).length - ? String(this.cchConfig.show_tabs).replace(/\s+/g, "").split(",") + ? String(this.cchConfig.show_tabs) + .replace(/\s+/g, "") + .split(",") : null; // Set the tab config source. @@ -1156,6 +1160,12 @@ if (!customElements.get("compact-custom-header")) { } function click(index) { + if ( + (activeTab == 0 && !wrap && left) || + (activeTab == tabs.length - 1 && !wrap && !left) + ) { + return; + } if (animate == "swipe") { let _in = left ? `${screen.width / 1.5}px` From 1a116f623040528bd692df902999d955edcea9be Mon Sep 17 00:00:00 2001 From: Ryan Meek Date: Tue, 21 May 2019 07:42:24 -0400 Subject: [PATCH 2/2] Fix view height when header is hidden. --- compact-custom-header.js | 1 - 1 file changed, 1 deletion(-) diff --git a/compact-custom-header.js b/compact-custom-header.js index 88a4ef3..c518efc 100644 --- a/compact-custom-header.js +++ b/compact-custom-header.js @@ -372,7 +372,6 @@ if (!customElements.get("compact-custom-header")) { styleHeader(root, tabContainer, header, view, tabs) { if (!this.cchConfig.header && !this.editMode) { header.style.display = "none"; - return; } else if (!this.editMode) { view.style.marginTop = "-48.5px"; if (view.querySelector("hui-view")) {