New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On onCorrectStroke
and onMistake
events, also return drawingPath's data
#59
Comments
👍 Good idea! I'll work on this soon. The tricky part is that the strokes are drawn in the character reference frame rather than the document's reference frame, but maybe we can return the set of points in both systems for maximum flexibility. This will also make it easier for us to track if stroke matching is working well or needs to be tweaked. |
Returned data could be to :
Please share a concrete example for "character reference frame rather than the document's reference frame". |
I mean, the MakeMeAHanzi character data is in terms of a 1024 x 1024 grid. So, to compare the stroke the user drew with the strokes from MakeMeAHanzi the user drawing needs to be converted to the same coordinate system as MakeMeAHanzi . In the SVG there's a #63 tries to address that by including a
pathString is an SVG path string in terms of the page's coordinates, and points is in terms of MakeMeAHanzi's coordinates |
😻 |
You'll need to run the build locally first. You can do that with:
Otherwise, I'll publish a build in the next hour or so. |
Just published v0.8.0 with these changes |
I downloaded v.0.8 from the cdn. On
but it just prints me
|
Does it work if you load from github? https://github.com/chanind/hanzi-writer/blob/master/dist/hanzi-writer.min.js |
Awesome, glad to hear it! |
For scientific purpose at least, it would be interesting to return the path of the user correct and mistake drawing. Beyond the current binary
onCorrectStroke
oronMistake
, paths would provide insight on what the learners draw, why do they fails.Currently
writer.quiz(options) :
onCorrectStroke
: function(data). Called when the user draws a stroke correctly. The function is called with an object containingtotalMistakes
which is the total mistakes made during the quiz so far,strokeNum
the current stroke number,mistakesOnStroke
the number of mistakes the user made drawing this stroke, andstrokesRemaining
the number of strokes left until the quiz is complete.onMistake
: function(data). Called when the user makes a mistake drawing a stroke. The function is called with an object containingtotalMistakes
which is the total mistakes made during the quiz so far,strokeNum
the current stroke number,mistakesOnStroke
the number of mistakes the user made drawing this stroke so far, andstrokesRemaining
the number of strokes left until the quiz is complete.Suggestion
On
onCorrectStroke
andonMistake
events, thefunction(data)
is called when the user draws a stroke correctly or incorectly. Indata
, add a key-valuedrawingPath
: the path' s data for the last drawing made by the user.Direct use
I would like to use these data to later on plot student's nth stroke's (
strokeNum
) drawing path, correct or mistakes, via d3js. The end rendering being something such :In language learning, it's the field of error analysis.
The text was updated successfully, but these errors were encountered: