mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-25 02:36:21 +03:00
feat(settings): add pinch to zoom setting
This commit is contained in:
parent
415d36ce32
commit
082fbecebc
7 changed files with 17 additions and 4 deletions
|
@ -16,6 +16,7 @@ export interface PreferencesSettings {
|
||||||
hideAccountHoverCard: boolean
|
hideAccountHoverCard: boolean
|
||||||
grayscaleMode: boolean
|
grayscaleMode: boolean
|
||||||
enableAutoplay: boolean
|
enableAutoplay: boolean
|
||||||
|
disablePinchToZoom: boolean
|
||||||
experimentalVirtualScroller: boolean
|
experimentalVirtualScroller: boolean
|
||||||
experimentalGitHubCards: boolean
|
experimentalGitHubCards: boolean
|
||||||
experimentalUserPicker: boolean
|
experimentalUserPicker: boolean
|
||||||
|
@ -72,6 +73,7 @@ export const DEFAULT__PREFERENCES_SETTINGS: PreferencesSettings = {
|
||||||
hideAccountHoverCard: false,
|
hideAccountHoverCard: false,
|
||||||
grayscaleMode: false,
|
grayscaleMode: false,
|
||||||
enableAutoplay: true,
|
enableAutoplay: true,
|
||||||
|
disablePinchToZoom: false,
|
||||||
experimentalVirtualScroller: true,
|
experimentalVirtualScroller: true,
|
||||||
experimentalGitHubCards: true,
|
experimentalGitHubCards: true,
|
||||||
experimentalUserPicker: true,
|
experimentalUserPicker: true,
|
||||||
|
|
|
@ -5,6 +5,7 @@ export function setupPageHeader() {
|
||||||
const { locale, locales, t } = useI18n()
|
const { locale, locales, t } = useI18n()
|
||||||
const colorMode = useColorMode()
|
const colorMode = useColorMode()
|
||||||
const buildInfo = useBuildInfo()
|
const buildInfo = useBuildInfo()
|
||||||
|
const disablePinchToZoom = usePreferences('disablePinchToZoom')
|
||||||
|
|
||||||
const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => {
|
const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => {
|
||||||
acc[l.code!] = l.dir ?? 'auto'
|
acc[l.code!] = l.dir ?? 'auto'
|
||||||
|
@ -15,6 +16,7 @@ export function setupPageHeader() {
|
||||||
htmlAttrs: {
|
htmlAttrs: {
|
||||||
lang: () => locale.value,
|
lang: () => locale.value,
|
||||||
dir: () => localeMap[locale.value] ?? 'auto',
|
dir: () => localeMap[locale.value] ?? 'auto',
|
||||||
|
class: () => disablePinchToZoom.value ? ['disable-pinch-to-zoom'] : [],
|
||||||
},
|
},
|
||||||
titleTemplate: (title) => {
|
titleTemplate: (title) => {
|
||||||
let titleTemplate = title ?? ''
|
let titleTemplate = title ?? ''
|
||||||
|
|
|
@ -330,6 +330,7 @@
|
||||||
},
|
},
|
||||||
"notifications_settings": "Benachrichtigungen",
|
"notifications_settings": "Benachrichtigungen",
|
||||||
"preferences": {
|
"preferences": {
|
||||||
|
"disable_pinch_to_zoom": "Deaktiviere das Zoomen mit zwei Fingern",
|
||||||
"enable_autoplay": "Autoplay aktivieren",
|
"enable_autoplay": "Autoplay aktivieren",
|
||||||
"github_cards": "GitHub Cards",
|
"github_cards": "GitHub Cards",
|
||||||
"hide_boost_count": "Boost-Zähler ausblenden",
|
"hide_boost_count": "Boost-Zähler ausblenden",
|
||||||
|
|
|
@ -376,6 +376,7 @@
|
||||||
},
|
},
|
||||||
"notifications_settings": "Notifications",
|
"notifications_settings": "Notifications",
|
||||||
"preferences": {
|
"preferences": {
|
||||||
|
"disable_pinch_to_zoom": "Disable pinch to zoom",
|
||||||
"enable_autoplay": "Enable Autoplay",
|
"enable_autoplay": "Enable Autoplay",
|
||||||
"github_cards": "GitHub Cards",
|
"github_cards": "GitHub Cards",
|
||||||
"grayscale_mode": "Grayscale mode",
|
"grayscale_mode": "Grayscale mode",
|
||||||
|
|
|
@ -369,6 +369,7 @@
|
||||||
},
|
},
|
||||||
"notifications_settings": "Notificaciones",
|
"notifications_settings": "Notificaciones",
|
||||||
"preferences": {
|
"preferences": {
|
||||||
|
"disable_pinch_to_zoom": "Deshabilitar pellizcar para hacer zoom",
|
||||||
"enable_autoplay": "Habilitar auto-reproducción",
|
"enable_autoplay": "Habilitar auto-reproducción",
|
||||||
"github_cards": "Tarjetas GitHub",
|
"github_cards": "Tarjetas GitHub",
|
||||||
"grayscale_mode": "Modo escala de grises",
|
"grayscale_mode": "Modo escala de grises",
|
||||||
|
|
|
@ -57,6 +57,12 @@ const userSettings = useUserSettings()
|
||||||
>
|
>
|
||||||
{{ $t('settings.preferences.enable_autoplay') }}
|
{{ $t('settings.preferences.enable_autoplay') }}
|
||||||
</SettingsToggleItem>
|
</SettingsToggleItem>
|
||||||
|
<SettingsToggleItem
|
||||||
|
:checked="getPreferences(userSettings, 'disablePinchToZoom')"
|
||||||
|
@click="togglePreferences('disablePinchToZoom')"
|
||||||
|
>
|
||||||
|
{{ $t('settings.preferences.disable_pinch_to_zoom') }}
|
||||||
|
</SettingsToggleItem>
|
||||||
<h2 px6 py4 mt2 font-bold text-xl flex="~ gap-1" items-center>
|
<h2 px6 py4 mt2 font-bold text-xl flex="~ gap-1" items-center>
|
||||||
<div i-ri-flask-line />
|
<div i-ri-flask-line />
|
||||||
{{ $t('settings.preferences.title') }}
|
{{ $t('settings.preferences.title') }}
|
||||||
|
|
|
@ -185,7 +185,7 @@ html {
|
||||||
--at-apply: bg-base text-base;
|
--at-apply: bg-base text-base;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
html.disable-pinch-to-zoom body {
|
||||||
/* Prevent arbitrary zooming on mobile devices */
|
/* Prevent arbitrary zooming on mobile devices */
|
||||||
touch-action: pan-x pan-y;
|
touch-action: pan-x pan-y;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue