Fix issue with text display
- Text display was broken due to referring to 'text' instead of 'newText'.
This commit is contained in:
parent
c9fcff128a
commit
5c2a4bf7c0
|
@ -323,14 +323,14 @@
|
|||
$("output").innerHTML = c;
|
||||
}
|
||||
|
||||
if (newText[charNum] === ' ') {
|
||||
charNum++;
|
||||
}
|
||||
|
||||
newText =
|
||||
"<span class=\"hilighted\">" + newText.substring(0, charNum) + "</span>" +
|
||||
newText.substring(charNum, newText.length);
|
||||
|
||||
if (text[charNum + 1] === ' ') {
|
||||
charNum++;
|
||||
}
|
||||
|
||||
sendText.innerHTML = newText;
|
||||
}
|
||||
|
||||
|
|
14
trainer.js
14
trainer.js
|
@ -206,13 +206,27 @@ let CwTrainer = (function () {
|
|||
//
|
||||
// Set the Words per Minute to be used by this trainer.
|
||||
//
|
||||
// wpm: The words per minute to use for each character
|
||||
// fw: The Farnsworth equivalent words per minute
|
||||
//
|
||||
setWpm(wpm, fw) {
|
||||
// "1.2" is a magic constant here, derived from the fact that
|
||||
// if you were to send the word "PARIS" one time per minute, each
|
||||
// dot would be 1.2 seconds long. See also:
|
||||
//
|
||||
// http://sv8gxc.blogspot.com/2010/09/morse-code-101-in-wpm-bw-snr.html
|
||||
//
|
||||
let fwDotWidth = 1.2 / fw;
|
||||
|
||||
dotWidth = 1.2 / wpm;
|
||||
|
||||
// A dash is three dots wide
|
||||
dashWidth = dotWidth * 3.0;
|
||||
|
||||
// There are 3 dots of silence between characters
|
||||
charSpace = fwDotWidth * 3.0;
|
||||
|
||||
// There are 7 dots of silence between words
|
||||
wordSpace = fwDotWidth * 7.0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue