Skip to content

Commit f475b04

Browse files
committed
feat: adjust tray collapse animation
log: as title
1 parent e0515a1 commit f475b04

File tree

4 files changed

+33
-10
lines changed

4 files changed

+33
-10
lines changed

panels/dock/tray/package/ActionToggleCollapseDelegate.qml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ AppletItemButton {
1616

1717
z: 5
1818

19-
icon.name: isHorizontal ? (collapsed ? "expand-left" : "expand-right") : (collapsed ? "expand-up" : "expand-down")
19+
icon.name: isHorizontal ? "expand-right" : "expand-up"
2020

2121
padding: itemPadding
2222

@@ -25,6 +25,26 @@ AppletItemButton {
2525
toolTip.close()
2626
}
2727

28+
states: [
29+
State {
30+
name: "opened"
31+
when: !collapsed
32+
PropertyChanges { target: root.contentItem; rotation: 180 }
33+
},
34+
35+
State {
36+
name: "closed"
37+
when: collapsed
38+
PropertyChanges { target: root.contentItem; rotation: 0 }
39+
}
40+
]
41+
42+
transitions: [
43+
Transition {
44+
RotationAnimation { duration: 200; }
45+
}
46+
]
47+
2848
PanelToolTip {
2949
id: toolTip
3050
text: qsTr("Collapse tray")

panels/dock/tray/package/TrayContainer.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ Item {
9595
height: containerSize.height
9696

9797
Behavior on width {
98-
NumberAnimation { duration: 200; easing.type: Easing.OutQuad }
98+
NumberAnimation { duration: 200; easing.type: collapsed ? Easing.OutQuad : Easing.InQuad }
9999
}
100100

101101
Behavior on height {
102-
NumberAnimation { duration: 200; easing.type: Easing.OutQuad }
102+
NumberAnimation { duration: 200; easing.type: collapsed ? Easing.OutQuad : Easing.InQuad }
103103
}
104104

105105
// Delegates

panels/dock/tray/package/TrayItemPositioner.qml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,35 @@ Control {
2626
x: visualPosition.x
2727
y: visualPosition.y
2828
Behavior on x {
29-
NumberAnimation { duration: 200; easing.type: Easing.OutQuad }
29+
NumberAnimation { duration: 200; easing.type: collapsed ? Easing.OutQuad : Easing.InQuad }
3030
}
3131
Behavior on y {
32-
NumberAnimation { duration: 200; easing.type: Easing.OutQuad }
32+
NumberAnimation { duration: 200; easing.type: collapsed ? Easing.OutQuad : Easing.InQuad }
3333
}
3434
states: [
3535
State {
3636
when: root.itemVisible
3737
PropertyChanges { target: root; opacity: 1.0 }
38+
PropertyChanges { target: root; scale: 1.0 }
3839
PropertyChanges { target: root; visible: true }
3940
},
4041
State {
4142
name: "item-invisible"
4243
when: !root.itemVisible
43-
PropertyChanges { target: root; opacity: 0.0 }
44+
PropertyChanges { target: root; opacity: 0 }
45+
PropertyChanges { target: root; scale: 0.2 }
4446
}
4547
]
4648
transitions: [
4749
Transition {
4850
to: "item-invisible"
4951
SequentialAnimation {
50-
NumberAnimation { property: "opacity"; easing.type: Easing.InQuad; duration: 200 }
52+
NumberAnimation { properties: "opacity,scale"; easing.type: Easing.OutQuad; duration: 200 }
5153
PropertyAction { target: root; property: "visible"; value: false }
5254
}
5355
},
5456
Transition {
55-
NumberAnimation { property: "opacity"; easing.type: Easing.OutQuad; duration: 200 }
57+
NumberAnimation { properties: "opacity,scale"; easing.type: Easing.InQuad; duration: 200 }
5658
}
5759
]
5860
}

panels/dock/tray/traysortordermodel.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,10 @@ void TraySortOrderModel::updateVisualIndexes()
363363
results[0]->setData(-1, TraySortOrderModel::VisualIndexRole);
364364
if (itemVisible) {
365365
toogleCollapseActionVisible = true;
366-
results[0]->setData(currentVisualIndex, TraySortOrderModel::VisualIndexRole);
367366
if (!m_collapsed) {
368-
currentVisualIndex++;
367+
results[0]->setData(currentVisualIndex++, TraySortOrderModel::VisualIndexRole);
368+
} else {
369+
results[0]->setData(currentVisualIndex-1, TraySortOrderModel::VisualIndexRole);
369370
}
370371
}
371372
}

0 commit comments

Comments
 (0)