diff --git a/graphql/schema/types/config.graphql b/graphql/schema/types/config.graphql index 732296572..e82ea93e2 100644 --- a/graphql/schema/types/config.graphql +++ b/graphql/schema/types/config.graphql @@ -339,6 +339,7 @@ input ConfigImageLightboxInput { resetZoomOnNav: Boolean scrollMode: ImageLightboxScrollMode scrollAttemptsBeforeChange: Int + disableAnimation: Boolean } type ConfigImageLightboxResult { @@ -348,6 +349,7 @@ type ConfigImageLightboxResult { resetZoomOnNav: Boolean scrollMode: ImageLightboxScrollMode scrollAttemptsBeforeChange: Int! + disableAnimation: Boolean } input ConfigInterfaceInput { diff --git a/internal/api/resolver_mutation_configure.go b/internal/api/resolver_mutation_configure.go index d49105916..b39cf373a 100644 --- a/internal/api/resolver_mutation_configure.go +++ b/internal/api/resolver_mutation_configure.go @@ -493,6 +493,8 @@ func (r *mutationResolver) ConfigureInterface(ctx context.Context, input ConfigI r.setConfigString(config.ImageLightboxScrollModeKey, (*string)(options.ScrollMode)) r.setConfigInt(config.ImageLightboxScrollAttemptsBeforeChange, options.ScrollAttemptsBeforeChange) + + r.setConfigBool(config.ImageLightboxDisableAnimation, options.DisableAnimation) } if input.CSS != nil { diff --git a/internal/manager/config/config.go b/internal/manager/config/config.go index 3b3b2c054..73b9de3ab 100644 --- a/internal/manager/config/config.go +++ b/internal/manager/config/config.go @@ -209,6 +209,7 @@ const ( ImageLightboxResetZoomOnNav = "image_lightbox.reset_zoom_on_nav" ImageLightboxScrollModeKey = "image_lightbox.scroll_mode" ImageLightboxScrollAttemptsBeforeChange = "image_lightbox.scroll_attempts_before_change" + ImageLightboxDisableAnimation = "image_lightbox.disable_animation" UI = "ui" @@ -1296,6 +1297,10 @@ func (i *Config) GetImageLightboxOptions() ConfigImageLightboxResult { if v := i.with(ImageLightboxScrollAttemptsBeforeChange); v != nil { ret.ScrollAttemptsBeforeChange = v.Int(ImageLightboxScrollAttemptsBeforeChange) } + if v := i.with(ImageLightboxDisableAnimation); v != nil { + value := v.Bool(ImageLightboxDisableAnimation) + ret.DisableAnimation = &value + } return ret } diff --git a/internal/manager/config/ui.go b/internal/manager/config/ui.go index 699091154..b7033f193 100644 --- a/internal/manager/config/ui.go +++ b/internal/manager/config/ui.go @@ -13,6 +13,7 @@ type ConfigImageLightboxResult struct { ResetZoomOnNav *bool `json:"resetZoomOnNav"` ScrollMode *ImageLightboxScrollMode `json:"scrollMode"` ScrollAttemptsBeforeChange int `json:"scrollAttemptsBeforeChange"` + DisableAnimation *bool `json:"disableAnimation"` } type ImageLightboxDisplayMode string diff --git a/ui/v2.5/graphql/data/config.graphql b/ui/v2.5/graphql/data/config.graphql index ac3656efb..1c3e9dc1b 100644 --- a/ui/v2.5/graphql/data/config.graphql +++ b/ui/v2.5/graphql/data/config.graphql @@ -100,6 +100,7 @@ fragment ConfigInterfaceData on ConfigInterfaceResult { resetZoomOnNav scrollMode scrollAttemptsBeforeChange + disableAnimation } disableDropdownCreate { performer diff --git a/ui/v2.5/src/components/Settings/SettingsInterfacePanel/SettingsInterfacePanel.tsx b/ui/v2.5/src/components/Settings/SettingsInterfacePanel/SettingsInterfacePanel.tsx index ba93385b5..bbc334a96 100644 --- a/ui/v2.5/src/components/Settings/SettingsInterfacePanel/SettingsInterfacePanel.tsx +++ b/ui/v2.5/src/components/Settings/SettingsInterfacePanel/SettingsInterfacePanel.tsx @@ -599,6 +599,13 @@ export const SettingsInterfacePanel: React.FC = PatchComponent( saveLightboxSettings({ scrollAttemptsBeforeChange: v }) } /> + + saveLightboxSettings({ disableAnimation: v })} + /> diff --git a/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx b/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx index f0f057d86..65c15024c 100644 --- a/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx +++ b/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx @@ -200,6 +200,8 @@ export const LightboxComponent: React.FC = ({ config?.interface.imageLightbox.scrollAttemptsBeforeChange ?? 0 ); + const disableAnimation = config?.interface.imageLightbox.disableAnimation; + function setSlideshowDelay(v: number) { setLightboxSettings({ slideshowDelay: v }); } @@ -340,6 +342,10 @@ export const LightboxComponent: React.FC = ({ (isUserAction = true) => { if (isSwitchingPage || index === -1) return; + if (disableAnimation) { + setInstant(); + } + setShowChapters(false); setMovingLeft(true); @@ -357,13 +363,25 @@ export const LightboxComponent: React.FC = ({ resetIntervalCallback.current(); } }, - [images, pageCallback, isSwitchingPage, resetIntervalCallback, index] + [ + images, + pageCallback, + isSwitchingPage, + resetIntervalCallback, + index, + disableAnimation, + setInstant, + ] ); const handleRight = useCallback( (isUserAction = true) => { if (isSwitchingPage) return; + if (disableAnimation) { + setInstant(); + } + setMovingLeft(false); setShowChapters(false); @@ -388,6 +406,8 @@ export const LightboxComponent: React.FC = ({ isSwitchingPage, resetIntervalCallback, index, + disableAnimation, + setInstant, ] ); diff --git a/ui/v2.5/src/locales/en-GB.json b/ui/v2.5/src/locales/en-GB.json index 37ef0d12b..e4c8b6a7c 100644 --- a/ui/v2.5/src/locales/en-GB.json +++ b/ui/v2.5/src/locales/en-GB.json @@ -938,6 +938,7 @@ }, "lightbox": { "delay": "Delay (Sec)", + "disable_animation": "Disable transition animation between images", "display_mode": { "fit_horizontally": "Fit horizontally", "fit_to_screen": "Fit to screen",