From 97c2e2bf5a6e0a497e0a11cde6611c68f3767cd6 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 6 Aug 2025 14:32:40 +0800 Subject: fix(launcher:selection): widget switching --- launcher/components/App.qml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'launcher/components/App.qml') diff --git a/launcher/components/App.qml b/launcher/components/App.qml index 6f0e4ce..f36e10e 100644 --- a/launcher/components/App.qml +++ b/launcher/components/App.qml @@ -53,6 +53,41 @@ IComponent { selectedIndex++; } + home: function () { + if (repeater.count === 0) + return true; + selectedIndex = -1; + selectedIndex = 0; + } + end: function () { + if (repeater.count === 0) + return true; + selectedIndex = repeater.count; + selectedIndex = repeater.count - 1; + } + + pgup: function () { + if (repeater.count === 0) + return true; + const pageSize = Math.floor(flickable.height / (General.appIconSize + Launcher.innerMargin * 2)); + if (selectedIndex - pageSize < 0) { + selectedIndex = 0; + } else { + selectedIndex -= pageSize; + } + } + + pgdn: function () { + if (repeater.count === 0) + return true; + const pageSize = Math.floor(flickable.height / (General.appIconSize + Launcher.innerMargin * 2)); + if (selectedIndex + pageSize >= repeater.count) { + selectedIndex = repeater.count - 1; + } else { + selectedIndex += pageSize; + } + } + onEntriesChanged: { selectedIndex = 0; flickable.contentY = 0; -- cgit v1.2.3