HInteractiveRectangle: add missing pressed effect

This commit is contained in:
miruka 2019-08-17 17:05:24 -04:00
parent 7319c8d7b4
commit 1663b166c7
2 changed files with 15 additions and 9 deletions

View File

@ -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 }

View File

@ -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