fix(workspace): add 120ms scroll throttle timer and auto-close popups on workspace switch to eliminate lag
This commit is contained in:
parent
8bc059af5f
commit
17d9edbd0c
@ -95,12 +95,22 @@ GlassPanel {
|
|||||||
id: wsItemMouse
|
id: wsItemMouse
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: WorkspaceService.switchTo(wsItem.wsNumber)
|
onClicked: {
|
||||||
|
PopupService.closeAll()
|
||||||
|
WorkspaceService.switchTo(wsItem.wsNumber)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scroll Throttle Timer (Eliminates scroll lag during rapid mouse wheel scrolling)
|
||||||
|
Timer {
|
||||||
|
id: scrollThrottleTimer
|
||||||
|
interval: 120
|
||||||
|
repeat: false
|
||||||
|
}
|
||||||
|
|
||||||
// Global Mouse Wheel Scroll Area
|
// Global Mouse Wheel Scroll Area
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -108,6 +118,10 @@ GlassPanel {
|
|||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
|
|
||||||
onWheel: (wheel) => {
|
onWheel: (wheel) => {
|
||||||
|
if (scrollThrottleTimer.running) return;
|
||||||
|
scrollThrottleTimer.restart();
|
||||||
|
PopupService.closeAll()
|
||||||
|
|
||||||
if (wheel.angleDelta.y < 0) {
|
if (wheel.angleDelta.y < 0) {
|
||||||
if (WorkspaceService.activeWorkspace < WorkspaceService.totalWorkspaces) {
|
if (WorkspaceService.activeWorkspace < WorkspaceService.totalWorkspaces) {
|
||||||
WorkspaceService.switchTo(WorkspaceService.activeWorkspace + 1)
|
WorkspaceService.switchTo(WorkspaceService.activeWorkspace + 1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user