Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 09c837d

Browse files
committed
Merge branch 'master' of github.com:amy21206/RunestoneComponents
2 parents ace7909 + 7496e7a commit 09c837d

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

runestone/parsons/js/parsons.js

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ export default class Parsons extends RunestoneBase {
233233
that.clearFeedback();
234234
$(that.checkButton).prop("disabled", false);
235235
that.resetView();
236+
that.checkCount = 0;
236237
that.logMove("reset");
237238
that.setLocalStorage();
238239
});
@@ -283,12 +284,15 @@ export default class Parsons extends RunestoneBase {
283284
var distractHelptext = "";
284285
if (textBlock.includes("#paired:")) {
285286
distractIndex = textBlock.indexOf("#paired:");
286-
distractHelptext = textBlock.substring(distractIndex + 8, textBlock.length).trim();
287+
distractHelptext = textBlock
288+
.substring(distractIndex + 8, textBlock.length)
289+
.trim();
287290
textBlock = textBlock.substring(0, distractIndex + 7);
288-
}
289-
else if (textBlock.includes("#distractor:")) {
291+
} else if (textBlock.includes("#distractor:")) {
290292
distractIndex = textBlock.indexOf("#distractor:");
291-
distractHelptext = textBlock.substring(distractIndex + 12, textBlock.length).trim();
293+
distractHelptext = textBlock
294+
.substring(distractIndex + 12, textBlock.length)
295+
.trim();
292296
textBlock = textBlock.substring(0, distractIndex + 11);
293297
}
294298
textBlock = textBlock.replace(
@@ -402,7 +406,10 @@ export default class Parsons extends RunestoneBase {
402406
if (this.options.numbered != undefined) {
403407
height_add = 1;
404408
}
405-
if (this.options.language == "natural" || this.options.language == "math") {
409+
if (
410+
this.options.language == "natural" ||
411+
this.options.language == "math"
412+
) {
406413
areaWidth = 300;
407414
maxFunction = function (item) {
408415
item.width(areaWidth - 22);
@@ -455,9 +462,9 @@ export default class Parsons extends RunestoneBase {
455462
areaHeight += Math.ceil(
456463
// For future more accurate height display, this calculation should also be conditionally based on fontFamily
457464
singleHeight +
458-
(linesItem[linesIndex].children.length - 1) *
459-
additionalHeight +
460-
height_add * addition
465+
(linesItem[linesIndex].children.length - 1) *
466+
additionalHeight +
467+
height_add * addition
461468
);
462469

463470
// Determine the longest text line in the current Parsons block and calculate its width - Vincent Qiu (September 2020)
@@ -475,9 +482,9 @@ export default class Parsons extends RunestoneBase {
475482
indent = linesItem[linesIndex].children[i].indent;
476483
itemLength = Math.ceil(
477484
pixelsPerIndent * indent +
478-
tempCanvasCtx.measureText(
479-
linesItem[linesIndex].children[i].innerText
480-
).width
485+
tempCanvasCtx.measureText(
486+
linesItem[linesIndex].children[i].innerText
487+
).width
481488
);
482489
longCount += Math.floor(itemLength / (widthLimit - 29));
483490
if (itemLength > maxInnerLength) {
@@ -589,9 +596,12 @@ export default class Parsons extends RunestoneBase {
589596
this.blocks[i].initializeInteractivity();
590597
}
591598
this.initializeTabIndex();
592-
if (this.options.language == "natural" || this.options.language == "math") {
599+
if (
600+
this.options.language == "natural" ||
601+
this.options.language == "math"
602+
) {
593603
if (typeof MathJax !== "undefined") {
594-
this.queueMathJax(this.outerDiv)
604+
this.queueMathJax(this.outerDiv);
595605
}
596606
}
597607
}
@@ -1294,7 +1304,6 @@ export default class Parsons extends RunestoneBase {
12941304
$(this.checkButton).prop("disabled", true);
12951305
localStorage.setItem(this.adaptiveId + "Solved", true);
12961306
this.recentAttempts = this.checkCount;
1297-
this.checkCount = 0;
12981307
localStorage.setItem(
12991308
this.adaptiveId + "recentAttempts",
13001309
this.recentAttempts
@@ -1550,9 +1559,9 @@ export default class Parsons extends RunestoneBase {
15501559
duration:
15511560
Math.sqrt(
15521561
Math.pow(endY - startY, 2) +
1553-
Math.pow(endX - startX, 2)
1562+
Math.pow(endX - startX, 2)
15541563
) *
1555-
4 +
1564+
4 +
15561565
500,
15571566
start: function () {
15581567
that.moving = block;

0 commit comments

Comments
 (0)