Jacob-Griffin / TelephonePictionary2.0

New version of blowyourfaceoff.com using more modern web technology than php and raw javascript
https://byfo.net
0 stars 0 forks source link

[Firefox] First line per canvas gets eaten (visually) #45

Closed Jacob-Griffin closed 3 months ago

Jacob-Griffin commented 3 months ago

While testing another round of #31, I discovered that in firefox, the first line that's drawn on a given canvas just stops abruptly soon after starting. When you undo and redo, the full line you should have seen gets restored, not just the little truncated bit. After the first time it happens, it does not happen again until the next time the canvas loads (on reload or on new round)

There is no event triggering that actually finishes the line, and undo-redo works, so it's not that the line stops drawing internally, it's just a visual bug. The tricky part though, is figuring out why this is breaking, since the canvas context doesn't have many good tools for debugging like that, and it's browser specific

Jacob-Griffin commented 3 months ago

Still not totally sure what was causing it, but since it was clearly something to do with a path not being active, I decided to add an unconditional beginPath() every draw step. Surprisingly, this does not affect expected behavior, and has an almost indistinguishable difference in performance. Adding this, the issue seems to be fixed. With this and the other changes from the last round of #31, canvas seems to work really smoothly now. Closing this.

Consider reopening if this does end up being more performance-stealing than previously though