From cb38b11db3b1765d4e70b4291a15eefa92b978f1 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 17 Sep 2021 15:12:25 +0200 Subject: [PATCH] Hide inactive instances more agressively --- nymea-app/ui/RootItem.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nymea-app/ui/RootItem.qml b/nymea-app/ui/RootItem.qml index c887ce1f..debbcec4 100644 --- a/nymea-app/ui/RootItem.qml +++ b/nymea-app/ui/RootItem.qml @@ -86,6 +86,18 @@ Item { interactive: false currentIndex: configuredHostsModel.currentIndex + onCurrentIndexChanged: visibleHackTimer.start(); + + // Hack: we only want the current one visible for performance reasons, however, during transitions this might look odd + // as we need to show two views partially at the same time. + // Couldn't find a way to determine the swipeView position, so let's assume it's moving for a second after currentIndex changed + Timer { + id: visibleHackTimer + repeat: false + interval: 500 + running: false + } + Repeater { id: mainRepeater model: configuredHostsModel @@ -94,6 +106,7 @@ Item { height: swipeView.height width: swipeView.width clip: true + visible: SwipeView.isCurrentItem || visibleHackTimer.running readonly property ConfiguredHost configuredHost: configuredHostsModel.get(index)