Compare commits

...

2 commits

Author SHA1 Message Date
userquin
d8960ff691 Merge branch 'main' into userquin/feat-add-pinch-to-zoom-setting
# Conflicts:
#	styles/global.css
2023-01-30 14:35:15 +01:00
userquin
082fbecebc feat(settings): add pinch to zoom setting 2023-01-29 16:06:42 +01:00
7 changed files with 18 additions and 0 deletions

View file

@ -16,6 +16,7 @@ export interface PreferencesSettings {
hideAccountHoverCard: boolean
grayscaleMode: boolean
enableAutoplay: boolean
disablePinchToZoom: boolean
experimentalVirtualScroller: boolean
experimentalGitHubCards: boolean
experimentalUserPicker: boolean
@ -72,6 +73,7 @@ export const DEFAULT__PREFERENCES_SETTINGS: PreferencesSettings = {
hideAccountHoverCard: false,
grayscaleMode: false,
enableAutoplay: true,
disablePinchToZoom: false,
experimentalVirtualScroller: true,
experimentalGitHubCards: true,
experimentalUserPicker: true,

View file

@ -5,6 +5,7 @@ export function setupPageHeader() {
const { locale, locales, t } = useI18n()
const colorMode = useColorMode()
const buildInfo = useBuildInfo()
const disablePinchToZoom = usePreferences('disablePinchToZoom')
const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => {
acc[l.code!] = l.dir ?? 'auto'
@ -15,6 +16,7 @@ export function setupPageHeader() {
htmlAttrs: {
lang: () => locale.value,
dir: () => localeMap[locale.value] ?? 'auto',
class: () => disablePinchToZoom.value ? ['disable-pinch-to-zoom'] : [],
},
titleTemplate: (title) => {
let titleTemplate = title ?? ''

View file

@ -330,6 +330,7 @@
},
"notifications_settings": "Benachrichtigungen",
"preferences": {
"disable_pinch_to_zoom": "Deaktiviere das Zoomen mit zwei Fingern",
"enable_autoplay": "Autoplay aktivieren",
"github_cards": "GitHub Cards",
"hide_boost_count": "Boost-Zähler ausblenden",

View file

@ -376,6 +376,7 @@
},
"notifications_settings": "Notifications",
"preferences": {
"disable_pinch_to_zoom": "Disable pinch to zoom",
"enable_autoplay": "Enable Autoplay",
"github_cards": "GitHub Cards",
"grayscale_mode": "Grayscale mode",

View file

@ -369,6 +369,7 @@
},
"notifications_settings": "Notificaciones",
"preferences": {
"disable_pinch_to_zoom": "Deshabilitar pellizcar para hacer zoom",
"enable_autoplay": "Habilitar auto-reproducción",
"github_cards": "Tarjetas GitHub",
"grayscale_mode": "Modo escala de grises",

View file

@ -57,6 +57,12 @@ const userSettings = useUserSettings()
>
{{ $t('settings.preferences.enable_autoplay') }}
</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>
<div i-ri-flask-line />
{{ $t('settings.preferences.title') }}

View file

@ -185,6 +185,11 @@ html {
--at-apply: bg-base text-base;
}
html.disable-pinch-to-zoom body {
/* Prevent arbitrary zooming on mobile devices */
touch-action: pan-x pan-y;
}
.sparkline--fill {
fill: var(--c-primary-active);
opacity: 0.2;