File tree 1 file changed +16
-3
lines changed
frontend/src/views/HomeView 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 2
2
import { ref , watch , useTemplateRef , h } from ' vue'
3
3
import { useI18n } from ' vue-i18n'
4
4
5
- import { APP_TITLE , message } from ' @/utils'
5
+ import { APP_TITLE , debounce , message } from ' @/utils'
6
6
import { useAppSettingsStore , useProfilesStore , useKernelApiStore , useEnvStore } from ' @/stores'
7
7
8
8
import { useModal } from ' @/components/Modal'
@@ -102,11 +102,24 @@ const handleShowKernelLogs = () => {
102
102
.open ()
103
103
}
104
104
105
+ let scrollEventCount = 0
106
+ const resetScrollEventCount = debounce (() => (scrollEventCount = 0 ), 100 )
107
+
105
108
const onMouseWheel = (e : WheelEvent ) => {
106
109
if (! appSettingsStore .app .kernel .running ) return
107
- const isDown = e .deltaY > 0
108
110
109
- showController .value = isDown || controllerRef .value ?.scrollTop !== 0
111
+ const currentScrollTop = controllerRef .value ?.scrollTop ?? 0
112
+ const isScrollingDown = e .deltaY > 0
113
+
114
+ if (isScrollingDown || currentScrollTop === 0 ) {
115
+ scrollEventCount += 1
116
+ }
117
+
118
+ if (scrollEventCount >= 5 ) {
119
+ showController .value = isScrollingDown || currentScrollTop !== 0
120
+ }
121
+
122
+ resetScrollEventCount ()
110
123
}
111
124
112
125
const onTunSwitchChange = async (enable : boolean ) => {
You can’t perform that action at this time.
0 commit comments