@@ -264,6 +264,10 @@ ScopeView {
264264 }
265265 }
266266 }
267+ Behavior on positionPx {
268+ enabled: previewListView.open
269+ UbuntuNumberAnimation {}
270+ }
267271 }
268272
269273 Connections {
@@ -328,9 +332,15 @@ ScopeView {
328332 scopeView.scope.preview( item.uri, item.icon, item.category, 0, item.mimetype, item.title, item.comment, item.dndUri, item.metadata)
329333 if (oldRow != -1) {
330334 if (row < oldRow) {
331− categoryView.contentY -= categoryDelegate.cellHeight
335+ if (categoryView.contentY - categoryDelegate.cellHeight < 0) {
336+ effect.positionPx -= categoryDelegate.cellHeight - categoryView.contentY
337+ }
338+ categoryView.contentY = Math.max(0, categoryView.contentY - categoryDelegate.cellHeight)
332339 } else if (row > oldRow){
333− categoryView.contentY += categoryDelegate.cellHeight
340+ if (categoryView.contentY + categoryDelegate.cellHeight > categoryView.contentHeight - categoryView.height) {
341+ effect.positionPx += categoryDelegate.cellHeight - (categoryView.contentY - (categoryView.contentHeight - categoryView.height))
342+ }
343+ categoryView.contentY = Math.min(categoryView.contentHeight - categoryView.height, categoryView.contentY + categoryDelegate.cellHeight)
334344 }
335345 }
336346 }
@@ -353,7 +363,9 @@ ScopeView {
353363 categoryDelegate.highlightIndex = currentIndex;
354364 } else {
355365 // Cancel any pending preview requests or actions
356− previewListView.currentItem.previewData.cancelAction();
366+ if (previewListView.currentItem.previewData !== undefined) {
367+ previewListView.currentItem.previewData.cancelAction();
368+ }
357369 scopeView.scope.cancelActivation();
358370 model = undefined;
359371 categoryView.correctExpandedCategory();