fix: restore smooth scroll animation for keyboard navigation in wallpaper selector panel

This commit is contained in:
tibssy
2026-03-26 02:33:06 +00:00
parent c524c9611f
commit ea1710c9c9
+2 -22
View File
@@ -1051,19 +1051,8 @@ SmartPanel {
bottomMargin: Style.marginS
onCurrentIndexChanged: {
// Synchronize scroll with current item position
if (currentIndex >= 0) {
let row = Math.floor(currentIndex / columns);
let itemY = row * cellHeight;
let viewportTop = contentY;
let viewportBottom = viewportTop + height;
// If item is out of view, scroll
if (itemY < viewportTop) {
contentY = Math.max(0, itemY - cellHeight);
} else if (itemY + cellHeight > viewportBottom) {
contentY = Math.min(contentHeight - height, itemY + cellHeight - height);
}
positionViewAtIndex(currentIndex, GridView.Contain);
}
}
@@ -1524,16 +1513,7 @@ SmartPanel {
onCurrentIndexChanged: {
if (currentIndex >= 0) {
let row = Math.floor(currentIndex / columns);
let itemY = row * cellHeight;
let viewportTop = contentY;
let viewportBottom = viewportTop + height;
if (itemY < viewportTop) {
contentY = Math.max(0, itemY - cellHeight);
} else if (itemY + cellHeight > viewportBottom) {
contentY = Math.min(contentHeight - height, itemY + cellHeight - height);
}
positionViewAtIndex(currentIndex, GridView.Contain);
}
}