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) { if (root.taskSwitcher.visible) {
// update task switcher drag // 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 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); taskSwitcher.taskSwitcherState.yPosition = Math.max(0, taskSwitcher.taskSwitcherState.yPosition - offsetY);
taskSwitcher.taskSwitcherState.xPosition -= offsetX;
// TODO add x swipe
//taskSwitcher.taskSwitcherState.xPosition -= offsetX;
} }
if (!root.taskSwitcher.visible && Math.abs(startMouseY - mouse.y) > PlasmaCore.Units.gridUnit && taskSwitcher.tasksCount) { 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 model
required property var displaysModel 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 previewHeight
required property real previewWidth 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 opacity: 1 - dragOffset / taskSwitcher.height
@ -178,12 +174,6 @@ Item {
color: PlasmaCore.Theme.backgroundColor color: PlasmaCore.Theme.backgroundColor
clip: true clip: true
transform: Scale {
origin.x: item.width / 2
origin.y: item.height / 2
xScale: delegate.scale
yScale: delegate.scale
}
Item { Item {
id: item id: item

View file

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

View file

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