Closed plduhoux closed 1 month ago
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Attention: Patch coverage is 88.88889%
with 1 line
in your changes missing coverage. Please review.
Project coverage is 96.36%. Comparing base (
b5c0d39
) to head (0f092f7
). Report is 1 commits behind head on master.
Files with missing lines | Patch % | Lines |
---|---|---|
src/Quiz.ts | 80.00% | 1 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
That sounds like it was hard to debug, but looks like a reasonable solution! Thanks for submitting this!
:tada: This PR is included in version 3.7.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Thanks for merging it ! That was hard to debug effectively, but I really needed it 😅
Problem
When drawing a Hanzi character in quiz mode on mobile devices, certain strokes were being interrupted or stopped halfway through when wrote quickly. This was caused by the touchmove event ceasing to fire. The root issue was that a node within the SVG element was being removed during the stroke drawing process, disrupting the touch event stream. I found this issue which relates a similar problem : https://stackoverflow.com/questions/29384973/touchmove-event-stops-triggering-after-any-element-is-removed-from-dom
Solution
Instead of removing strokes immediately after they are drawn, I modified the logic to preserve the strokes by keeping their corresponding IDs. These strokes are now removed only at the end of the quiz session (on cancel or startQuiz). This prevents disruption of the touchmove event and allows for uninterrupted stroke drawing.
Testing
Tested on mobile device to ensure strokes are drawn smoothly and consistently. (in my app : https://hanziquest.plduhoux.fr/ where I frequently had the issue before these changes and no longer have these) Verified that the strokes are correctly removed when the quiz ends (I updated the tests so we test that strokes opacity is 0 instead of testing it was removed, I kept the test where the stroke have been removed after a cancel call)