on xenial help sign in
bring back clicking functionality and fix inverted animation
55d26b9Michael Zanetti
Launcher/LauncherPanel.qml+30−29
@@ -28,7 +28,7 @@ Item {
28 rotation: inverted ? 180 : 0
28 rotation: inverted ? 180 : 0
29
29
30 property var model
30 property var model
31− property bool inverted: false
31+ property bool inverted: true
32 property bool dragging: false
32 property bool dragging: false
33 property bool moving: launcherListView.moving || launcherListView.flicking || dndArea.draggedItem !== undefined
33 property bool moving: launcherListView.moving || launcherListView.flicking || dndArea.draggedItem !== undefined
34 property int dragPosition: 0
34 property int dragPosition: 0
@@ -117,6 +117,7 @@ Item {
117 highlightRangeMode: ListView.ApplyRange
117 highlightRangeMode: ListView.ApplyRange
118 preferredHighlightBegin: (height - itemSize) / 2
118 preferredHighlightBegin: (height - itemSize) / 2
119 preferredHighlightEnd: (height + itemSize) / 2
119 preferredHighlightEnd: (height + itemSize) / 2
120+ layoutDirection: root.inverted ? Qt.RightToLeft : Qt.LeftToRight
120
121
121 // The height of the area where icons start getting folded
122 // The height of the area where icons start getting folded
122 property int foldingAreaHeight: itemSize * 0.75
123 property int foldingAreaHeight: itemSize * 0.75
@@ -133,7 +134,6 @@ Item {
133 itemHeight: launcherListView.itemSize
134 itemHeight: launcherListView.itemSize
134 itemWidth: launcherListView.itemSize
135 itemWidth: launcherListView.itemSize
135 width: itemWidth
136 width: itemWidth
136−// height: dragging ? units.gu(2) : launcherListView.itemSize
137 height: itemHeight
137 height: itemHeight
138 iconName: model.icon
138 iconName: model.icon
139 inverted: root.inverted
139 inverted: root.inverted
@@ -148,7 +148,7 @@ Item {
148 when: dragging
148 when: dragging
149 PropertyChanges {
149 PropertyChanges {
150 target: launcherDelegate
150 target: launcherDelegate
151− angle: 80
151+ angle: root.inverted ? -80 : 80
152 offset: effectiveHeight / 2
152 offset: effectiveHeight / 2
153 height: effectiveHeight
153 height: effectiveHeight
154 }
154 }
@@ -162,30 +162,6 @@ Item {
162 NumberAnimation { properties: "height"; duration: 150 }
162 NumberAnimation { properties: "height"; duration: 150 }
163 }
163 }
164 ]
164 ]
165−
166−/* onClicked: {
167− // First/last item do the scrolling at more than 12 degrees
168− if (index == 0 || index == launcherListView.count -1) {
169− if (angle > 12) {
170− launcherListView.flick(0, -launcherListView.clickFlickSpeed);
171− } else if (angle < -12) {
172− launcherListView.flick(0, launcherListView.clickFlickSpeed);
173− } else {
174− root.applicationSelected(LauncherModel.get(index).desktopFile);
175− }
176− return;
177− }
178−
179− // the rest launches apps up to an angle of 30 degrees
180− if (angle > 30) {
181− launcherListView.flick(0, -launcherListView.clickFlickSpeed);
182− } else if (angle < -30) {
183− launcherListView.flick(0, launcherListView.clickFlickSpeed);
184− } else {
185− root.applicationSelected(LauncherModel.get(index).desktopFile);
186− }
187− }
188− */
189 }
165 }
190
166
191 MouseArea {
167 MouseArea {
@@ -214,10 +190,36 @@ Item {
214 var realContentY = launcherListView.contentY + launcherListView.topMargin
190 var realContentY = launcherListView.contentY + launcherListView.topMargin
215 selectedItem = launcherListView.itemAt(mouseX, mouseY + realContentY)
191 selectedItem = launcherListView.itemAt(mouseX, mouseY + realContentY)
216 selectedItem.highlighted = true
192 selectedItem.highlighted = true
217−
218 }
193 }
219
194
220 onClicked: {
195 onClicked: {
196+ var realItemSize = launcherListView.itemSize + launcherListView.spacing
197+ var realContentY = launcherListView.contentY + launcherListView.topMargin
198+ var index = Math.floor((mouseY + realContentY) / realItemSize);
199+ var clickedItem = launcherListView.itemAt(mouseX, mouseY + realContentY)
200+
201+ print("clicked on", index, clickedItem)
202+
203+ // First/last item do the scrolling at more than 12 degrees
204+ if (index == 0 || index == launcherListView.count -1) {
205+ if (clickedItem.angle > 12) {
206+ launcherListView.flick(0, -launcherListView.clickFlickSpeed);
207+ } else if (clickedItem.angle < -12) {
208+ launcherListView.flick(0, launcherListView.clickFlickSpeed);
209+ } else {
210+ root.applicationSelected(LauncherModel.get(index).desktopFile);
211+ }
212+ return;
213+ }
214+
215+ // the rest launches apps up to an angle of 30 degrees
216+ if (clickedItem.angle > 30) {
217+ launcherListView.flick(0, -launcherListView.clickFlickSpeed);
218+ } else if (clickedItem.angle < -30) {
219+ launcherListView.flick(0, launcherListView.clickFlickSpeed);
220+ } else {
221+ root.applicationSelected(LauncherModel.get(index).desktopFile);
222+ }
221 }
223 }
222
224
223 onCanceled: {
225 onCanceled: {
@@ -238,7 +240,6 @@ Item {
238
240
239 onPressAndHold: {
241 onPressAndHold: {
240 var realItemSize = launcherListView.itemSize + launcherListView.spacing
242 var realItemSize = launcherListView.itemSize + launcherListView.spacing
241−
242 var realContentY = launcherListView.contentY + launcherListView.topMargin
243 var realContentY = launcherListView.contentY + launcherListView.topMargin
243 draggedIndex = Math.floor((mouseY + realContentY) / realItemSize);
244 draggedIndex = Math.floor((mouseY + realContentY) / realItemSize);
244
245