From 1663b166c7d363ec5296dad0a1ca832d27dd2059 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 17 Aug 2019 17:05:24 -0400 Subject: [PATCH] HInteractiveRectangle: add missing pressed effect --- src/qml/Base/HInteractiveRectangle.qml | 16 +++++++++++----- src/themes/Default.qpl | 8 ++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/qml/Base/HInteractiveRectangle.qml b/src/qml/Base/HInteractiveRectangle.qml index db7cac1e..cce66f6b 100644 --- a/src/qml/Base/HInteractiveRectangle.qml +++ b/src/qml/Base/HInteractiveRectangle.qml @@ -3,21 +3,27 @@ import QtQuick 2.12 HRectangle { property bool checkable: false // TODO property bool checked: false + property alias pressed: tap.pressed + property alias hovered: hover.hovered readonly property QtObject _ir: theme.controls.interactiveRectangle color: _ir.background HRectangle { anchors.fill: parent + visible: opacity > 0 + Behavior on opacity { HNumberAnimation { factor: 0.5 } } - color: checked ? _ir.checkedOverlay : _ir.hoveredOverlay - - opacity: checked ? _ir.checkedOpacity : - hover.hovered ? _ir.hoveredOpacity : + opacity: pressed ? _ir.pressedOpacity : + checked ? _ir.checkedOpacity : + hovered ? _ir.hoveredOpacity : 0 - Behavior on opacity { HNumberAnimation { factor: 0.66 } } + color: pressed ? _ir.pressedOverlay : + checked ? _ir.checkedOverlay : + hovered ? _ir.hoveredOverlay : + "transparent" } HoverHandler { id: hover } diff --git a/src/themes/Default.qpl b/src/themes/Default.qpl index a06ffd80..573153dc 100644 --- a/src/themes/Default.qpl +++ b/src/themes/Default.qpl @@ -95,13 +95,13 @@ controls: interactiveRectangle: color background: "transparent" - color hoveredOverlay: hsluv(0, 0, 80) - color pressedOverlay: hsluv(0, 0, 80) - color checkedOverlay: hsluv(0, 0, 80) + color hoveredOverlay: hsluv(0, 0, 100) + color pressedOverlay: hsluv(0, 0, 100) + color checkedOverlay: hsluv(0, 0, 100) real hoveredOpacity: 0.1 real pressedOpacity: 0.2 - real checkedOpacity: 0.1 + real checkedOpacity: 0.08 textField: color background: colors.inputBackground