@@ -381,42 +381,30 @@ ScopeView {
381 // when the first preview is ready to be displayed.
381 // when the first preview is ready to be displayed.
382 property bool init: true
382 property bool init: true
385− property int oldRow: -1
386− property bool categoryWasFiltered: false
387− property int initialContenY: 0
389 onCurrentIndexChanged: {
384 onCurrentIndexChanged: {
390 var row = Math.floor(currentIndex / categoryDelegate.columns);
385 var row = Math.floor(currentIndex / categoryDelegate.columns);
391 if (categoryDelegate.collapsedRowCount <= row) {
386 if (categoryDelegate.collapsedRowCount <= row) {
392 categoryView.expandedCategoryId = categoryId
387 categoryView.expandedCategoryId = categoryId
394− if (!init && model !== undefined) {
395− var item = model.get(currentIndex)
396− scopeView.scope.preview( item.uri, item.icon, item.category, 0, item.mimetype, item.title, item.comment, item.dndUri, item.metadata)
400− if (categoryView.contentY - categoryDelegate.cellHeight < 0) {
401− effectMove = categoryDelegate.cellHeight - categoryView.contentY;
402− effect.positionPx -= effectMove;
404− categoryView.contentY -= categoryDelegate.cellHeight - effectMove;
405− } else if (row > oldRow){
407− if (categoryView.contentY + categoryDelegate.cellHeight > categoryView.contentHeight - categoryView.height) {
408− effectMove = (categoryView.contentY + categoryDelegate.cellHeight) - (categoryView.contentHeight - categoryView.height);
409− effect.positionPx += effectMove;
411− categoryView.contentY += categoryDelegate.cellHeight - effectMove
417 if (open) {
390 if (open) {
418 categoryDelegate.highlightIndex = currentIndex
391 categoryDelegate.highlightIndex = currentIndex
393+ var itemY = categoryView.contentItem.mapFromItem(categoryDelegate.currentItem).y;
394+ var newContentY = itemY - effect.positionPx - categoryDelegate.verticalSpacing;
395+ print("newContentY", newContentY, categoryView.originY);
396+ var effectAdjust = effect.positionPx;
397+ if (newContentY < 0) {
398+ effectAdjust += newContentY;
401+ if (newContentY > categoryView.contentHeight - categoryView.height) {
402+ effectAdjust += -(categoryView.contentHeight - categoryView.height) + newContentY
403+ newContentY = categoryView.contentHeight - categoryView.height;
406+ effect.positionPx = effectAdjust;
407+ categoryView.contentY = newContentY;
422 property bool open: false
410 property bool open: false
@@ -426,6 +414,7 @@ ScopeView {
426 if (open) {
414 if (open) {
427 onScreen = true;
415 onScreen = true;
428 categoryDelegate.highlightIndex = currentIndex;
416 categoryDelegate.highlightIndex = currentIndex;
417+ newContentY = categoryView.contentY;
430 // Cancel any pending preview requests or actions
419 // Cancel any pending preview requests or actions
431 if (previewListView.currentItem.previewData !== undefined) {
420 if (previewListView.currentItem.previewData !== undefined) {