taskswitcher: Apply scale on entire task list, rather than single task

This commit is contained in:
Devin Lin 2021-12-27 18:29:14 -05:00
parent cccde09f3d
commit 264de1b6df
4 changed files with 19 additions and 29 deletions

View file

@ -79,11 +79,9 @@ Item {
if (root.taskSwitcher.visible) {
// update task switcher drag
let offsetY = (mouse.y - oldMouseY) * 0.5; // we want to make the gesture take a longer swipe than it being pixel perfect
let offsetX = (mouse.x - oldMouseX) * 0.5;
let offsetX = (mouse.x - oldMouseX) * 0.7; // we want to make the gesture not too hard to swipe, but not too easy
taskSwitcher.taskSwitcherState.yPosition = Math.max(0, taskSwitcher.taskSwitcherState.yPosition - offsetY);
// TODO add x swipe
//taskSwitcher.taskSwitcherState.xPosition -= offsetX;
taskSwitcher.taskSwitcherState.xPosition -= offsetX;
}
if (!root.taskSwitcher.visible && Math.abs(startMouseY - mouse.y) > PlasmaCore.Units.gridUnit && taskSwitcher.tasksCount) {

View file

@ -22,17 +22,13 @@ Item {
required property var model
required property var displaysModel
readonly property point taskScreenPoint: model ? Qt.point(model.ScreenGeometry.x, model.ScreenGeometry.y) : Qt.point(0, 0)
readonly property real dragOffset: -control.y
property bool active: model ? model.IsActive : false
required property real previewHeight
required property real previewWidth
property bool showHeader: true
readonly property point taskScreenPoint: model ? Qt.point(model.ScreenGeometry.x, model.ScreenGeometry.y) : Qt.point(0, 0)
readonly property real dragOffset: -control.y
property real scale: 1
property bool showHeader: true
opacity: 1 - dragOffset / taskSwitcher.height
@ -178,12 +174,6 @@ Item {
color: PlasmaCore.Theme.backgroundColor
clip: true
transform: Scale {
origin.x: item.width / 2
origin.y: item.height / 2
xScale: delegate.scale
yScale: delegate.scale
}
Item {
id: item

View file

@ -21,6 +21,13 @@ Item {
opacity: taskSwitcherState.wasInActiveTask ? 1 : Math.min(1, taskSwitcherState.yPosition / taskSwitcherState.openedYPosition)
transform: Scale {
origin.x: root.width / 2
origin.y: root.height / 2
xScale: taskSwitcherState.currentScale
yScale: taskSwitcherState.currentScale
}
// taphandler activates even if delegate touched
TapHandler {
onTapped: {
@ -76,7 +83,7 @@ Item {
// ensure current task is above others
z: taskSwitcherState.currentTaskIndex === currentIndex ? 1 : 0
showHeader: currentIndex !== taskSwitcherState.currentTaskIndex || !taskSwitcherState.currentlyBeingOpened
showHeader: !taskSwitcherState.currentlyBeingOpened
width: taskSwitcherState.taskWidth
height: taskSwitcherState.taskHeight
@ -85,13 +92,6 @@ Item {
taskSwitcher: root.taskSwitcher
displaysModel: root.taskSwitcher.displaysModel
scale: {
if (taskSwitcherState.currentTaskIndex == currentIndex) {
return taskSwitcherState.currentScale;
}
return 1;
}
}
}
}

View file

@ -167,9 +167,11 @@ QtObject {
}
// update horizontal state
if (!currentlyBeingOpened) {
let duration = PlasmaCore.Units.longDuration * 2;
if (currentlyBeingOpened) {
animateGoToTaskIndex(currentTaskIndex, duration);
} else {
let currentTaskIndexPosition = xPositionFromTaskIndex(currentTaskIndex);
let duration = PlasmaCore.Units.longDuration * 2;
if (xPosition < currentTaskIndexPosition) {
if (movingRight) {
animateGoToTaskIndex(currentTaskIndex, duration);
@ -198,8 +200,8 @@ QtObject {
target: root
property: "yPosition"
to: openedYPosition
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad
duration: PlasmaCore.Units.longDuration * 2
easing.type: Easing.OutBack
onFinished: {
root.currentlyBeingOpened = false;