Skip to content

Commit 4abfb03

Browse files
committed
ui: correct undo and redo count
1 parent 6a156d3 commit 4abfb03

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/ui-info.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { get } from "svelte/store";
21
import type { GameHistory, GameState, UIInfo } from "./public-types.ts";
32

43
export function useUI(state: GameState, history: GameHistory): UIInfo {
@@ -8,8 +7,8 @@ export function useUI(state: GameState, history: GameHistory): UIInfo {
87
copy: state.usage.copy,
98
paste: state.usage.paste,
109
cut: state.usage.cut,
11-
undo: history.tree.length - 1 - history.index,
12-
redo: history.index,
10+
undo: history.index / 2,
11+
redo: (history.tree.length - 1 - history.index) / 2,
1312
paused: state.paused,
1413
};
1514
}

0 commit comments

Comments
 (0)