From 1686c3c9beef380ad10240a96bd98afbfe8fec27 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 19 Oct 2021 23:14:30 +0200 Subject: [PATCH] Fix visuals for stateful garage doors --- nymea-app/ui/customviews/GarageController.qml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/nymea-app/ui/customviews/GarageController.qml b/nymea-app/ui/customviews/GarageController.qml index eacc7f0d..2da4bb85 100644 --- a/nymea-app/ui/customviews/GarageController.qml +++ b/nymea-app/ui/customviews/GarageController.qml @@ -60,9 +60,18 @@ Item { anchors.centerIn: parent width: parent.width height: parent.height + Style.margins - anchors.verticalCenterOffset: root.percentageState - ? -height * (1 - (root.percentageState.value / 100)) - : -height / 2 + anchors.verticalCenterOffset: { + if (root.percentageState) { + return -height * (1 - (root.percentageState.value / 100)) + } + if (root.stateState && root.stateState.value === "closed") { + return 0 + } + if (root.stateState && root.stateState.value === "open") { + return -height + } + return -height / 2 + } onPaint: { var ctx = getContext("2d"); ctx.reset();