mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-31 08:44:45 +00:00
fix task scrub icon list sometimes being off center
also fix animation duration and easing type not being in sync with task preview list. fixes https://invent.kde.org/plasma/plasma-mobile/-/issues/392
This commit is contained in:
parent
3adcd1d51c
commit
a41b386651
2 changed files with 15 additions and 12 deletions
|
|
@ -445,20 +445,18 @@ FocusScope {
|
||||||
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.longDuration } }
|
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.longDuration } }
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.right: parent.horizontalCenter
|
||||||
anchors.bottomMargin: taskSwitcherHelpers.openedYPosition * 5 / 8
|
anchors.bottomMargin: taskSwitcherHelpers.openedYPosition * 5 / 8
|
||||||
|
|
||||||
anchors.horizontalCenterOffset: {
|
anchors.rightMargin: {
|
||||||
let size = Kirigami.Units.iconSizes.large + Kirigami.Units.largeSpacing * 2;
|
let size = Kirigami.Units.iconSizes.large + Kirigami.Units.largeSpacing * 2;
|
||||||
let offset = (root.state.currentTaskIndex - 0.5) * size;
|
let offset = (root.state.currentTaskIndex + 0.5) * size;
|
||||||
return offset;
|
return -offset;
|
||||||
}
|
}
|
||||||
Behavior on anchors.horizontalCenterOffset {
|
Behavior on anchors.rightMargin {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
// TODO: this duration should track the duration of xAnim but that is variable through function parameter
|
duration: taskSwitcherHelpers.xAnimDuration;
|
||||||
// how do we make sure this is always the same duration?
|
easing.type: taskSwitcherHelpers.xAnimEasingType;
|
||||||
duration: Kirigami.Units.longDuration * 2;
|
|
||||||
easing.type: Easing.OutBack;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,10 @@ QtObject {
|
||||||
// we don't want to continuously send haptics, just once is enough
|
// we don't want to continuously send haptics, just once is enough
|
||||||
property bool hasVibrated: false
|
property bool hasVibrated: false
|
||||||
|
|
||||||
|
// made as variables to keep x anim in task list and task scrub icon list in sync
|
||||||
|
property int xAnimDuration: Kirigami.Units.longDuration * 2
|
||||||
|
property int xAnimEasingType: Easing.OutExpo
|
||||||
|
|
||||||
// ~~ measurement constants ~~
|
// ~~ measurement constants ~~
|
||||||
|
|
||||||
// dimensions of a real window on the screen
|
// dimensions of a real window on the screen
|
||||||
|
|
@ -161,9 +165,9 @@ QtObject {
|
||||||
|
|
||||||
// go to the task index, animated
|
// go to the task index, animated
|
||||||
function animateGoToTaskIndex(index, duration = Kirigami.Units.longDuration * 2, easing = Easing.OutExpo) {
|
function animateGoToTaskIndex(index, duration = Kirigami.Units.longDuration * 2, easing = Easing.OutExpo) {
|
||||||
xAnim.duration = duration;
|
xAnimDuration = duration;
|
||||||
|
xAnimEasingType = easing;
|
||||||
xAnim.to = xPositionFromTaskIndex(index);
|
xAnim.to = xPositionFromTaskIndex(index);
|
||||||
xAnim.easing.type = easing;
|
|
||||||
xAnim.restart();
|
xAnim.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,7 +223,8 @@ QtObject {
|
||||||
property var xAnim: NumberAnimation {
|
property var xAnim: NumberAnimation {
|
||||||
target: root.state
|
target: root.state
|
||||||
property: "xPosition"
|
property: "xPosition"
|
||||||
easing.type: Easing.OutBack
|
duration: xAnimDuration
|
||||||
|
easing.type: xAnimEasingType
|
||||||
}
|
}
|
||||||
|
|
||||||
property var openAnim: NumberAnimation {
|
property var openAnim: NumberAnimation {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue