Skip to content

Commit

Permalink
chore: extract pan distance as config variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin-w151 committed Feb 19, 2025
1 parent dfe2400 commit 07939fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib/components/news/story/content/StoryImageViewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import { Icon } from '@steeze-ui/svelte-icon';
import { ChevronLeft, ChevronRight, XMark } from '@steeze-ui/heroicons';
import { logger } from '$lib/utils/logger';
import { PAN_DISTANCE } from '$lib/configs/client';
interface Props {
image: StoryImage;
images?: Array<StoryImage>;
Expand Down Expand Up @@ -101,19 +103,19 @@
return;
case 'ArrowUp':
event.preventDefault();
panzoom?.pan(0, 50, { relative: true });
panzoom?.pan(0, PAN_DISTANCE, { relative: true });
return;
case 'ArrowDown':
event.preventDefault();
panzoom?.pan(0, -50, { relative: true });
panzoom?.pan(0, -PAN_DISTANCE, { relative: true });
return;
case 'ArrowLeft':
event.preventDefault();
panzoom?.pan(50, 0, { relative: true });
panzoom?.pan(PAN_DISTANCE, 0, { relative: true });
return;
case 'ArrowRight':
event.preventDefault();
panzoom?.pan(-50, 0, { relative: true });
panzoom?.pan(-PAN_DISTANCE, 0, { relative: true });
return;
}
} else {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/configs/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ export const NEWS_CHECK_UPDATES_INTERVAL_IN_MS = 1_800_000;

// Story
export const STORY_CONTENT_FETCH_MAX_RETRIES = 5;

// StoryImageViewer
export const PAN_DISTANCE = 50;

0 comments on commit 07939fe

Please sign in to comment.