mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
actiondrawer: Preload for first open
Preload the action drawer so that it doesn't get loaded only when the user attempts to open it for the first time (making it laggy).
This commit is contained in:
parent
a8b858dc3e
commit
16d8a26a97
1 changed files with 16 additions and 2 deletions
|
|
@ -35,13 +35,27 @@ Window {
|
|||
property alias actionDrawer: drawer
|
||||
property alias state: drawer.state
|
||||
|
||||
visible: drawer.intendedToBeVisible
|
||||
visible: true
|
||||
|
||||
color: "transparent"
|
||||
|
||||
// set input to transparent when closing to prevent window from taking unwanted touch inputs
|
||||
// Set input to transparent when closing to prevent window from taking unwanted touch inputs
|
||||
onStateChanged: MobileShell.ShellUtil.setInputTransparent(window, state === "close")
|
||||
|
||||
// Preload and render content to avoid lag on first open
|
||||
Component.onCompleted: {
|
||||
preloadTimer.start();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: preloadTimer
|
||||
interval: 1
|
||||
onTriggered: {
|
||||
// Set window visibility binding after preloading content to the action drawer state
|
||||
window.visible = Qt.binding(() => drawer.intendedToBeVisible);
|
||||
}
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
window.raise();
|
||||
|
|
|
|||
Loading…
Reference in a new issue