on xenial help sign in
Make sure we animate the height of the list only when we need to
commit1d213956ed35459ee887a99306092bcf384791f1 authorAlbert Astals <albert.astals@canonical.com> dateWed 18 Jun 2014, 16:50 (12 years ago) parent1024f46
1 file changed+19−2
qml/Dash/DashDepartments.qml+19−2
qml/Dash/DashDepartments.qml+19−2
@@ -110,14 +110,31 @@ AbstractButton {
110110 readonly property int maxHeight: (windowHeight - mapToItem(null, root.x, root.y).y) - units.gu(8)
111111 property int prevHeight: maxHeight
112112 height: currentItem ? currentItem.height : maxHeight
113− onHeightChanged: prevHeight = height;
113+ onHeightChanged: {
114+ if (root.showList) {
115+ prevHeight = currentItem.desiredHeight;
116+ }
117+ }
114118 anchors.top: root.bottom
115119 highlightMoveDuration: UbuntuAnimation.FastDuration
116120 delegate: DashDepartmentsList {
117121 objectName: "department" + index
118122 visible: height != 0
119123 width: departmentListView.width
120− height: !root.showList ? 0 : department && department.loaded ? Math.min(implicitHeight, departmentListView.maxHeight) : departmentListView.prevHeight
124+ property real desiredHeight: {
125+ if (root.showList) {
126+ if (department && department.loaded &&
127+ index == departmentListView.currentIndex && index * width == departmentListView.contentX)
128+ {
129+ return Math.min(implicitHeight, departmentListView.maxHeight);
130+ } else {
131+ return departmentListView.prevHeight;
132+ }
133+ } else {
134+ return 0;
135+ }
136+ }
137+ height: desiredHeight
121138 department: (nullifyDepartment || !scope) ? null : scope.getDepartment(departmentId)
122139 currentDepartment: root.currentDepartment
123140 onEnterDepartment: {