Commit 92d92959 authored by Devin Lin's avatar Devin Lin 🎨
Browse files

homescreens/halcyon: Don't have hovered state

parent 88417b3e
Pipeline #204064 passed with stage
in 1 minute and 13 seconds
......@@ -123,16 +123,63 @@ Item {
property bool inDrag: false
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: (mouse.button === Qt.RightButton) ? openContextMenu() : launch();
onReleased: {
delegate.Drag.drop();
inDrag = false;
}
onPressAndHold: { inDrag = true; openContextMenu() }
drag.target: inDrag ? delegate : undefined
// grow/shrink animation
property real zoomScale: 1
transform: Scale {
origin.x: mouseArea.width / 2;
origin.y: mouseArea.height / 2;
xScale: mouseArea.zoomScale
yScale: mouseArea.zoomScale
}
property bool launchAppRequested: false
NumberAnimation on zoomScale {
id: shrinkAnim
running: false
duration: MobileShell.MobileShellSettings.animationsEnabled ? 80 : 1
to: MobileShell.MobileShellSettings.animationsEnabled ? 0.95 : 1
onFinished: {
if (!mouseArea.pressed) {
growAnim.restart();
}
}
}
NumberAnimation on zoomScale {
id: growAnim
running: false
duration: MobileShell.MobileShellSettings.animationsEnabled ? 80 : 1
to: 1
onFinished: {
if (mouseArea.launchAppRequested) {
delegate.launch();
mouseArea.launchAppRequested = false;
}
}
}
onPressedChanged: {
if (pressed) {
growAnim.stop();
shrinkAnim.restart();
} else if (!pressed && !shrinkAnim.running) {
growAnim.restart();
}
}
// launch app handled by press animation
onClicked: (mouse.button === Qt.RightButton) ? openContextMenu() : launchAppRequested = true;
HoverHandler {
id: hoverHandler
acceptedDevices: PointerDevice.Mouse
......@@ -142,7 +189,7 @@ Item {
Rectangle {
anchors.fill: parent
radius: height / 2
color: mouseArea.pressed ? Qt.rgba(255, 255, 255, 0.2) : (hoverHandler.hovered ? Qt.rgba(255, 255, 255, 0.1) : "transparent")
color: mouseArea.pressed ? Qt.rgba(255, 255, 255, 0.2) : "transparent"
}
RowLayout {
......
......@@ -20,7 +20,7 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon
import org.kde.kirigami 2.19 as Kirigami
MobileShell.ExtendedAbstractButton {
MouseArea {
id: delegate
width: GridView.view.cellWidth
height: GridView.view.cellHeight
......@@ -40,8 +40,8 @@ MobileShell.ExtendedAbstractButton {
}
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressAndHold: openContextMenu()
onRightClickPressed: openContextMenu()
function launchApp() {
// launch app
......@@ -116,7 +116,7 @@ MobileShell.ExtendedAbstractButton {
}
}
// launch app handled by press animation
onClicked: launchAppRequested = true;
onClicked: (mouse.button === Qt.RightButton) ? openContextMenu() : launchAppRequested = true
ColumnLayout {
anchors {
......@@ -153,7 +153,7 @@ MobileShell.ExtendedAbstractButton {
// darken effect when hovered/pressed
layer {
enabled: delegate.pressed || delegate.mouseHovered
enabled: delegate.pressed
effect: ColorOverlay {
color: Qt.rgba(0, 0, 0, 0.3)
}
......
......@@ -64,24 +64,19 @@ Item {
}
}
ColumnLayout {
id: column
height: swipeView.height
QQC2.ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
width: swipeView.width
height: swipeView.height
property real horizontalMargin: Math.max(Kirigami.Units.largeSpacing, root.width * 0.1 / 2)
QQC2.ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
GridAppList {
id: gridAppList
interactive: root.interactive
leftMargin: column.horizontalMargin
rightMargin: column.horizontalMargin
effectiveContentWidth: swipeView.width - leftMargin - rightMargin
}
GridAppList {
id: gridAppList
property real horizontalMargin: Math.max(Kirigami.Units.largeSpacing, swipeView.width * 0.1 / 2)
interactive: root.interactive
leftMargin: horizontalMargin
rightMargin: horizontalMargin
effectiveContentWidth: swipeView.width - leftMargin - rightMargin
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment