mirror of
https://github.com/m1k1o/neko.git
synced 2026-11-03 00:11:48 -06:00
feat: add ?scroll query param to set scroll sensitivity on load (#681)
Follows the same pattern as the existing ?volume param. Lets users bake a preferred scroll sensitivity into the URL (useful for cast/embed setups where the settings panel isn't reachable), and it's persisted to localStorage afterwards so it sticks on future visits. Fixes #607
This commit is contained in:
@@ -206,6 +206,11 @@
|
||||
return Math.max(0.0, Math.min(!isNaN(numberParam) ? numberParam * 100 : 100, 100))
|
||||
}
|
||||
|
||||
get scroll() {
|
||||
const numberParam = parseInt(new URL(location.href).searchParams.get('scroll') || '', 10)
|
||||
return Math.max(1, Math.min(!isNaN(numberParam) ? numberParam : 10, 100))
|
||||
}
|
||||
|
||||
get isCastMode() {
|
||||
return !!new URL(location.href).searchParams.get('cast')
|
||||
}
|
||||
@@ -229,6 +234,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('scroll', { immediate: true })
|
||||
onScroll(scroll: number) {
|
||||
if (new URL(location.href).searchParams.has('scroll')) {
|
||||
this.$accessor.settings.setScroll(scroll)
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('hideControls', { immediate: true })
|
||||
onHideControls(enabled: boolean) {
|
||||
if (enabled) {
|
||||
|
||||
Reference in New Issue
Block a user