mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-04 12:52:06 -04:00
launcher: fix kb navigation not always showing last delegate in view
This commit is contained in:
@@ -81,6 +81,12 @@ function calculateNextIndex(flatModel, selectedFlatIndex, sectionId, viewMode, g
|
||||
return bounds.start + newPosInSection;
|
||||
}
|
||||
|
||||
var currentRow = Math.floor(posInSection / cols);
|
||||
var lastRow = Math.floor((bounds.count - 1) / cols);
|
||||
if (currentRow < lastRow) {
|
||||
return bounds.start + bounds.count - 1;
|
||||
}
|
||||
|
||||
var nextSection = findNextNonHeaderIndex(flatModel, bounds.end + 1);
|
||||
return nextSection !== -1 ? nextSection : selectedFlatIndex;
|
||||
}
|
||||
|
||||
@@ -130,24 +130,17 @@ Item {
|
||||
if (!entry || entry.isHeader)
|
||||
return;
|
||||
var rowIndex = _flatIndexToRowMap[index];
|
||||
if (rowIndex === undefined || rowIndex >= _cumulativeHeights.length)
|
||||
return;
|
||||
var row = _visualRows[rowIndex];
|
||||
if (!row)
|
||||
if (rowIndex === undefined)
|
||||
return;
|
||||
|
||||
var rowY = _cumulativeHeights[rowIndex];
|
||||
var rowHeight = row.height;
|
||||
var scrollY = mainListView.contentY - mainListView.originY;
|
||||
var viewHeight = mainListView.height;
|
||||
var headerH = stickyHeader.height;
|
||||
mainListView.positionViewAtIndex(rowIndex, ListView.Contain);
|
||||
|
||||
if (rowY < scrollY + headerH) {
|
||||
mainListView.contentY = Math.max(mainListView.originY, rowY - headerH + mainListView.originY);
|
||||
return;
|
||||
}
|
||||
if (rowY + rowHeight > scrollY + viewHeight) {
|
||||
mainListView.contentY = rowY + rowHeight - viewHeight + mainListView.originY;
|
||||
if (stickyHeader.visible && rowIndex < _cumulativeHeights.length) {
|
||||
var rowY = _cumulativeHeights[rowIndex];
|
||||
var scrollY = mainListView.contentY - mainListView.originY;
|
||||
if (rowY < scrollY + stickyHeader.height) {
|
||||
mainListView.contentY = Math.max(mainListView.originY, rowY - stickyHeader.height + mainListView.originY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user