Skip to content

Commit

Permalink
fixing error drawing after finishign quiz
Browse files Browse the repository at this point in the history
  • Loading branch information
chanind committed Jan 7, 2018
1 parent f53312c commit 9ddcae3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion dist/hanzi-writer-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -6046,13 +6046,13 @@ var Quiz = function () {
if (!this._userStroke) return Promise.resolve();

this._animator.animate(function (animation) {
if (!_this._isActive) return Promise.resolve();
var promises = [];
var nextStroke = _this._getNextStroke();
var isMatch = _this._strokeMatcher.strokeMatches(_this._userStroke, nextStroke);
promises.push(_this._userStrokeRenderer.fadeAndRemove(animation));
_this._userStroke = null;
_this._userStrokeRenderer = null;
if (!_this._isActive) return Promise.resolve();

if (isMatch) {
_this._handleSuccess(nextStroke, animation);
Expand Down Expand Up @@ -6086,6 +6086,7 @@ var Quiz = function () {
this._numRecentMistakes = 0;
var promise = this._drawMatchingStroke(stroke, animation);
if (this._currentStrokeIndex === this._character.getNumStrokes()) {
this._isActive = false;
(0, _utils.callIfExists)(this._quizOptions.onComplete, {
character: this._character.getSymbol(),
totalMistakes: this._totalMistakes
Expand Down
2 changes: 1 addition & 1 deletion dist/hanzi-writer-lib.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/hanzi-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6045,13 +6045,13 @@ var Quiz = function () {
if (!this._userStroke) return Promise.resolve();

this._animator.animate(function (animation) {
if (!_this._isActive) return Promise.resolve();
var promises = [];
var nextStroke = _this._getNextStroke();
var isMatch = _this._strokeMatcher.strokeMatches(_this._userStroke, nextStroke);
promises.push(_this._userStrokeRenderer.fadeAndRemove(animation));
_this._userStroke = null;
_this._userStrokeRenderer = null;
if (!_this._isActive) return Promise.resolve();

if (isMatch) {
_this._handleSuccess(nextStroke, animation);
Expand Down Expand Up @@ -6085,6 +6085,7 @@ var Quiz = function () {
this._numRecentMistakes = 0;
var promise = this._drawMatchingStroke(stroke, animation);
if (this._currentStrokeIndex === this._character.getNumStrokes()) {
this._isActive = false;
(0, _utils.callIfExists)(this._quizOptions.onComplete, {
character: this._character.getSymbol(),
totalMistakes: this._totalMistakes
Expand Down
2 changes: 1 addition & 1 deletion dist/hanzi-writer.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/Quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ class Quiz {
if (!this._userStroke) return Promise.resolve();

this._animator.animate((animation) => {
if (!this._isActive) return Promise.resolve();
const promises = [];
const nextStroke = this._getNextStroke();
const isMatch = this._strokeMatcher.strokeMatches(this._userStroke, nextStroke);
promises.push(this._userStrokeRenderer.fadeAndRemove(animation));
this._userStroke = null;
this._userStrokeRenderer = null;
if (!this._isActive) return Promise.resolve();

if (isMatch) {
this._handleSuccess(nextStroke, animation);
Expand Down Expand Up @@ -79,6 +79,7 @@ class Quiz {
this._numRecentMistakes = 0;
let promise = this._drawMatchingStroke(stroke, animation);
if (this._currentStrokeIndex === this._character.getNumStrokes()) {
this._isActive = false;
callIfExists(this._quizOptions.onComplete, {
character: this._character.getSymbol(),
totalMistakes: this._totalMistakes,
Expand Down

0 comments on commit 9ddcae3

Please sign in to comment.