pgn-viewer
pgn-viewer copied to clipboard
Support keyboard bindings to enter variations
Left and Right arrow keys go to the previous/next move, but it will be useful to enter variations as well.
Possible key suggestions:
- down key enters first non-mainline variation.
- shift+down only works on the first move of a variation and takes us to the first move of the sibling variation
- up key pops back up out of the variation.
Alternatively (even better), these could be exposed through the API.
Thanks!
Nice idea, I will give it a try (later 😄 ). I will think about different key bindings, and how they are used in different applications. With Lichess, you get:
- down key to switch to next variation, up for the previous (but not selecting).
- right selects then the current variation
What do you mean by
Alternatively (even better), these could be exposed through the API.
Should it be configurable, like (just a first idea)
keyMap: {
LEFT: "prevMove",
RIGHT: "nextMove",
DOWN: "nextVariant",
... }
The possible functions (no argument) are defined then that can be mapped.
What do you mean by
Alternatively (even better), these could be exposed through the API.
Should it be configurable, like (just a first idea)
keyMap: { LEFT: "prevMove", RIGHT: "nextMove", DOWN: "nextVariant", ... }
What I meant was that if there is a function enter-variation and a function next_move etc, some specialized use cases could write javascript that mixes and matches these. For example, in Chess-X, I find myself doing the following. There, the keys ⌘-down takes you into a variation. When I am at a node which is my blunder and has been annotated with a better variation, then that variation is not the child of my current node, it is a sibling. To get there, I have to press left followed by ⌘-down. I have keyboard maestro set up so that it does both these things when I press a different combination. With an API, one could create such custom combos.