Skip to content

Commit be38708

Browse files
committed
fix(nav): go previous to the last clicks state, close #57
1 parent d2f2445 commit be38708

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/client/logic/nav.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export function next() {
4646

4747
export async function prev() {
4848
if (clicks.value <= 0)
49-
prevSlide()
49+
await prevSlide()
50+
5051
else
5152
clicks.value -= 1
5253
}
@@ -60,9 +61,11 @@ export function nextSlide() {
6061
return go(next)
6162
}
6263

63-
export function prevSlide() {
64+
export async function prevSlide(lastClicks = true) {
6465
const next = Math.max(1, currentPage.value - 1)
65-
return go(next)
66+
await go(next)
67+
if (lastClicks)
68+
clicks.value = clicksTotal.value
6669
}
6770

6871
export function go(page: number) {

packages/client/logic/shortcuts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export function registerShotcuts() {
1414
shortcut('space', next)
1515
shortcut('right', next)
1616
shortcut('left', prev)
17-
shortcut('up', prevSlide)
17+
shortcut('up', () => prevSlide(false))
1818
shortcut('down', nextSlide)
19-
shortcut('shift_left', prevSlide)
19+
shortcut('shift_left', () => prevSlide(false))
2020
shortcut('shift_right', nextSlide)
2121
shortcut('d', toggleDark)
2222
shortcut('f', () => fullscreen.toggle())

0 commit comments

Comments
 (0)