mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-01 09:18:07 +00:00
homescreens/halcyon: Don't have hovered state
This commit is contained in:
parent
88417b3e0a
commit
92d9295995
3 changed files with 65 additions and 23 deletions
|
|
@ -123,16 +123,63 @@ Item {
|
||||||
|
|
||||||
property bool inDrag: false
|
property bool inDrag: false
|
||||||
|
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onClicked: (mouse.button === Qt.RightButton) ? openContextMenu() : launch();
|
|
||||||
onReleased: {
|
onReleased: {
|
||||||
delegate.Drag.drop();
|
delegate.Drag.drop();
|
||||||
inDrag = false;
|
inDrag = false;
|
||||||
}
|
}
|
||||||
onPressAndHold: { inDrag = true; openContextMenu() }
|
onPressAndHold: { inDrag = true; openContextMenu() }
|
||||||
|
|
||||||
drag.target: inDrag ? delegate : undefined
|
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 {
|
HoverHandler {
|
||||||
id: hoverHandler
|
id: hoverHandler
|
||||||
acceptedDevices: PointerDevice.Mouse
|
acceptedDevices: PointerDevice.Mouse
|
||||||
|
|
@ -142,7 +189,7 @@ Item {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: height / 2
|
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 {
|
RowLayout {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon
|
||||||
|
|
||||||
import org.kde.kirigami 2.19 as Kirigami
|
import org.kde.kirigami 2.19 as Kirigami
|
||||||
|
|
||||||
MobileShell.ExtendedAbstractButton {
|
MouseArea {
|
||||||
id: delegate
|
id: delegate
|
||||||
width: GridView.view.cellWidth
|
width: GridView.view.cellWidth
|
||||||
height: GridView.view.cellHeight
|
height: GridView.view.cellHeight
|
||||||
|
|
@ -40,8 +40,8 @@ MobileShell.ExtendedAbstractButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onPressAndHold: openContextMenu()
|
onPressAndHold: openContextMenu()
|
||||||
onRightClickPressed: openContextMenu()
|
|
||||||
|
|
||||||
function launchApp() {
|
function launchApp() {
|
||||||
// launch app
|
// launch app
|
||||||
|
|
@ -116,7 +116,7 @@ MobileShell.ExtendedAbstractButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// launch app handled by press animation
|
// launch app handled by press animation
|
||||||
onClicked: launchAppRequested = true;
|
onClicked: (mouse.button === Qt.RightButton) ? openContextMenu() : launchAppRequested = true
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors {
|
anchors {
|
||||||
|
|
@ -153,7 +153,7 @@ MobileShell.ExtendedAbstractButton {
|
||||||
|
|
||||||
// darken effect when hovered/pressed
|
// darken effect when hovered/pressed
|
||||||
layer {
|
layer {
|
||||||
enabled: delegate.pressed || delegate.mouseHovered
|
enabled: delegate.pressed
|
||||||
effect: ColorOverlay {
|
effect: ColorOverlay {
|
||||||
color: Qt.rgba(0, 0, 0, 0.3)
|
color: Qt.rgba(0, 0, 0, 0.3)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,24 +64,19 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
QQC2.ScrollView {
|
||||||
id: column
|
Layout.fillWidth: true
|
||||||
height: swipeView.height
|
Layout.fillHeight: true
|
||||||
width: swipeView.width
|
width: swipeView.width
|
||||||
|
height: swipeView.height
|
||||||
|
|
||||||
property real horizontalMargin: Math.max(Kirigami.Units.largeSpacing, root.width * 0.1 / 2)
|
GridAppList {
|
||||||
|
id: gridAppList
|
||||||
QQC2.ScrollView {
|
property real horizontalMargin: Math.max(Kirigami.Units.largeSpacing, swipeView.width * 0.1 / 2)
|
||||||
Layout.fillWidth: true
|
interactive: root.interactive
|
||||||
Layout.fillHeight: true
|
leftMargin: horizontalMargin
|
||||||
|
rightMargin: horizontalMargin
|
||||||
GridAppList {
|
effectiveContentWidth: swipeView.width - leftMargin - rightMargin
|
||||||
id: gridAppList
|
|
||||||
interactive: root.interactive
|
|
||||||
leftMargin: column.horizontalMargin
|
|
||||||
rightMargin: column.horizontalMargin
|
|
||||||
effectiveContentWidth: swipeView.width - leftMargin - rightMargin
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue