chrislicodes / obsidian-chess-study

A chess study helper and PGN viewer/editor for Obsidian.
GNU General Public License v3.0
36 stars 4 forks source link

Broken on Obsidian canvas #8

Open Witchell0 opened 9 months ago

Witchell0 commented 9 months ago

chess-study broken on obsidian canvas

I had this wonderful idea tracking key/critical variations of a chess game by using obsidian canvas but I am unable to implement this because chess-study is broken on Obsidian Canvas. The thought was to embed chess-study code blocks at specific moves in a chess game. This would enable me to visually map out development of games as I see fit (great for a visual learner like me) .

  1. fix chess-study code blocks so that they can be added properly in canvas
    • chess pieces are misaligned when chess-study is added to a canvas
    • chess pieces can no be moved when chess-study is added to a canvas
  2. allow for chess study code blocks to be loaded on a specific move on initial canvas/obsidian load or when you unfocus
    • currently it seems that the default behavior is to load to the last chess move.

Reproduce

latenitecoding commented 8 months ago

I've only done an initial investigation into this, but here's what I've learned about the issue.

fix chess-study code blocks so that they can be added properly in canvas

Canvas allows notes to be included in a visual map. If those notes include chess-study blocks, then those blocks will be visualized in the canvas. This works best by having one board per note.

chess pieces are misaligned when chess-study is added to a canvas

The chess-study block is set to be rendered to a specific size. The canvas note can be resized to be larger than the size of the board. Chess pieces are rendered correctly in this case. However, we can look into having responsive chessboards that fit to the size of the note.

chess pieces can no be moved when chess-study is added to a canvas

Unfortunately, I don't think this can be addressed. This appears to be an issue with the interaction between the ChessgroundAPI and Obsidian Canvas, neither of which we have control over. You can make use of the buttons in the chess-study block though to interact with the chess board. My recommendation is to edit the chessboard in the original note and save the moves. This will allow you to cycle through them in the Canvas.

allow for chess study code blocks to be loaded on a specific move on initial canvas/obsidian load or when you unfocus

This feature is coming in the pipeline. I have a PR that I'm going to file that allows the current move to be saved so that users can select which move (or initial board) they want loaded when the board is initially rendered. I've tested it with Canvas and it does work.

chrislicodes commented 8 months ago

Thanks for the analysis @latenitecoding! Responsiveness is the next thing on my list and while the plugin now supports parsing FEN, having an additional option to choose which move to display on load might be an useful addition. 🤔