mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
taskswitcher: Add darken effect for not centered tasks
This commit is contained in:
parent
264de1b6df
commit
fd88eb36e9
2 changed files with 20 additions and 8 deletions
|
|
@ -25,10 +25,11 @@ Item {
|
|||
required property real previewHeight
|
||||
required property real previewWidth
|
||||
|
||||
readonly property point taskScreenPoint: model ? Qt.point(model.ScreenGeometry.x, model.ScreenGeometry.y) : Qt.point(0, 0)
|
||||
readonly property point taskScreenPoint: (model && model.ScreenGeometry) ? Qt.point(model.ScreenGeometry.x, model.ScreenGeometry.y) : Qt.point(0, 0)
|
||||
readonly property real dragOffset: -control.y
|
||||
|
||||
property bool showHeader: true
|
||||
property real darken: 0
|
||||
|
||||
opacity: 1 - dragOffset / taskSwitcher.height
|
||||
|
||||
|
|
@ -58,16 +59,11 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
QQC2.Control {
|
||||
Item {
|
||||
id: control
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
|
||||
// drag up gesture
|
||||
DragHandler {
|
||||
id: dragHandler
|
||||
|
|
@ -105,8 +101,9 @@ Item {
|
|||
}
|
||||
|
||||
// application
|
||||
contentItem: ColumnLayout {
|
||||
ColumnLayout {
|
||||
id: column
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
||||
// header
|
||||
|
|
@ -193,6 +190,13 @@ Item {
|
|||
source: Qt.resolvedUrl("./Thumbnail.qml")
|
||||
}
|
||||
|
||||
// darken effect
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "black"
|
||||
opacity: delegate.darken
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: delegate.activateApp()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,8 +83,16 @@ Item {
|
|||
// ensure current task is above others
|
||||
z: taskSwitcherState.currentTaskIndex === currentIndex ? 1 : 0
|
||||
|
||||
// only show header once task switcher is opened
|
||||
showHeader: !taskSwitcherState.currentlyBeingOpened
|
||||
|
||||
// darken effect as task gets away from the centre of the screen
|
||||
darken: {
|
||||
let distFromCentreProgress = Math.abs(x - repeater.leftMargin) / taskSwitcherState.taskWidth;
|
||||
let upperBoundAdjust = Math.min(0.5, distFromCentreProgress) - 0.2;
|
||||
return Math.max(0, upperBoundAdjust);
|
||||
}
|
||||
|
||||
width: taskSwitcherState.taskWidth
|
||||
height: taskSwitcherState.taskHeight
|
||||
previewWidth: taskSwitcherState.previewWidth
|
||||
|
|
|
|||
Loading…
Reference in a new issue