Fix: check previous alphabets

This commit is contained in:
2019-05-17 07:24:03 +09:00
parent 1530e0cf2b
commit 286aa2261d
+26 -10
View File
@@ -490,10 +490,10 @@ var TypingTest = {
var typingLetter = ""; var typingLetter = "";
var typingNextLetter = ""; var typingNextLetter = "";
// console.log("-----"); console.log("-----");
// console.log("inputConent : '" + inputContent + "'"); console.log("inputConent : '" + inputContent + "'");
// console.log("inputIndex : " + inputIndex); console.log("inputIndex : " + inputIndex);
// console.log("misspelledIndex : " + misspelledIndex); console.log("misspelledIndex : " + misspelledIndex);
if(inputIndex < 0) if(inputIndex < 0)
inputLetter = ""; inputLetter = "";
@@ -505,9 +505,9 @@ var TypingTest = {
if(misspelledIndex <= typingContent.length) if(misspelledIndex <= typingContent.length)
typingNextLetter = typingContent[misspelledIndex + 1]; typingNextLetter = typingContent[misspelledIndex + 1];
// console.log("inputLetter : '" + inputLetter + "'"); console.log("inputLetter : '" + inputLetter + "'");
// console.log("typingLetter : '" + typingLetter + "'"); console.log("typingLetter : '" + typingLetter + "'");
// console.log("typingNextLetter : '" + typingNextLetter + "'"); console.log("typingNextLetter : '" + typingNextLetter + "'");
// var typingAlphabet = ""; // var typingAlphabet = "";
var inputLetterAlphabets = StringUtil.toKoreanAlphabets(inputLetter); var inputLetterAlphabets = StringUtil.toKoreanAlphabets(inputLetter);
@@ -517,8 +517,12 @@ var TypingTest = {
// console.log("typingLetterAlphabets : " + typingLetterAlphabets); // console.log("typingLetterAlphabets : " + typingLetterAlphabets);
// console.log("typingNextLetterAlphabets : " + typingNextLetterAlphabets); // console.log("typingNextLetterAlphabets : " + typingNextLetterAlphabets);
if(misspelledIndex < inputIndex) {
highlightKey = "Backspace";
}
// typing nothing yet // typing nothing yet
if(inputLetterAlphabets.length == 0) { else if(inputLetterAlphabets.length == 0) {
// highlightKey = typingLetterAlphabets[0]; // highlightKey = typingLetterAlphabets[0];
highlightKey = StringUtil.chosung(typingLetter); highlightKey = StringUtil.chosung(typingLetter);
} }
@@ -549,7 +553,12 @@ var TypingTest = {
var typingLetterJungsung = StringUtil.jungsung(typingLetter); var typingLetterJungsung = StringUtil.jungsung(typingLetter);
// console.log("* 222"); // console.log("* 222");
// inputLetter jungsung == typingLetter jungsung // inputLetter jungsung == typingLetter jungsung
if(StringUtil.jungsung(inputLetter) == StringUtil.jungsung(typingLetter)) {
// inputLetter chosung != typingLetter chosung
if(StringUtil.chosung(inputLetter) != StringUtil.chosung(typingLetter))
highlightKey = "Backspace";
else if(StringUtil.jungsung(inputLetter) == StringUtil.jungsung(typingLetter)) {
if(StringUtil.hasJongsung(typingLetter)) { if(StringUtil.hasJongsung(typingLetter)) {
// highlightKey = StringUtil.jongsung(typingLetter); // highlightKey = StringUtil.jongsung(typingLetter);
var typingLetterJongsung = StringUtil.jongsung(typingLetter); var typingLetterJongsung = StringUtil.jongsung(typingLetter);
@@ -603,8 +612,15 @@ var TypingTest = {
// after typing jongsung // after typing jongsung
else if(inputLetterAlphabets.length == 3) { else if(inputLetterAlphabets.length == 3) {
// inputLetter chosung != typingLetter chosung
if(StringUtil.chosung(inputLetter) != StringUtil.chosung(typingLetter))
highlightKey = "Backspace";
// inputLetter jungsung != typingLetter jungsung
else if(StringUtil.jungsung(inputLetter) != StringUtil.jungsung(typingLetter))
highlightKey = "Backspace";
// 입력할 글자에 종성이 있을 경우 // 입력할 글자에 종성이 있을 경우
if(StringUtil.hasJongsung(typingLetter)) { else if(StringUtil.hasJongsung(typingLetter)) {
var typingLetterJongsung = StringUtil.jongsung(typingLetter); var typingLetterJongsung = StringUtil.jongsung(typingLetter);
// 입력한 글자의 종성과 입력할 글자의 종성이 같은 경우 // 입력한 글자의 종성과 입력할 글자의 종성이 같은 경우
if(StringUtil.jongsung(inputLetter) == typingLetterJongsung) if(StringUtil.jongsung(inputLetter) == typingLetterJongsung)