mliebelt / pgn-viewer

Simple PGN viewer with the necessary features to display chess games
GNU General Public License v3.0
163 stars 44 forks source link

Piece positioning at top left #123

Closed nftechie closed 4 years ago

nftechie commented 5 years ago

Hello,

We have noticed an odd behavior where the pieces sometimes display at the top left corner. We don't see any javascript errors, and it seems to only sometimes happen on the first page load (so maybe a dependency issue, or cache issue, or load speed issue).

For more context, the chess tool we are building is rendered inside of an iFrame.

Do you have any thoughts as to what might cause something like this to happen?

Screen Shot 2019-10-20 at 8 11 21 AM
mliebelt commented 4 years ago

I don't have any idea. As you may have noticed, I am just using https://github.com/ornicar/chessground so I do not know how to debug such a behavior. I never saw that in my usage of PgnViewerJS, so no idea what is happening here.

mliebelt commented 4 years ago

Please have a look at #145, which exactly described when it happened. There a call to redrawAll of Chessground was sufficient to fix the problem. It seems to be a race condition where the board is not in HTML rendered, so no context (width, height) is known.

Please have a look at the solution there, perhaps that eventHandler to redraw it will fix it as well for you. I will close that bug, because I am not able to reproduce it.