aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/StyleProviderQuiz.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/client/views/StyleProviderQuiz.tsx b/src/client/views/StyleProviderQuiz.tsx
index f1e79b44b..5d6a37832 100644
--- a/src/client/views/StyleProviderQuiz.tsx
+++ b/src/client/views/StyleProviderQuiz.tsx
@@ -47,7 +47,7 @@ export namespace styleProviderQuiz {
* @param texts
*/
async function createBoxes(img: ImageBox, boxes: [[[number, number]]], texts: [string]) {
- img.Document._quizBoxes = new List<Doc>([]);
+ img.Document.quizBoxes = new List<Doc>([]);
for (let i = 0; i < boxes.length; i++) {
const coords = boxes[i] ? boxes[i] : [];
const width = coords[1][0] - coords[0][0];
@@ -68,7 +68,7 @@ export namespace styleProviderQuiz {
newCol.forceActive = true;
newCol.quiz = text;
newCol[DocData][Doc.LayoutFieldKey(newCol) + '_transform'] = 'none';
- Doc.AddDocToList(img.Document, '_quizBoxes', newCol);
+ Doc.AddDocToList(img.Document, 'quizBoxes', newCol);
img.addDocument(newCol);
// img._loading = false;
}
@@ -246,6 +246,7 @@ export namespace styleProviderQuiz {
function check(img: ImageBox) {
//this._loading = true;
imgQuizBoxes(img).forEach(async doc => {
+ console.log(doc[DocData].title);
const input = StrCast(doc[DocData].title);
if (imgQuizMode(img) == quizMode.SMART && input) {
const questionText = 'Question: What was labeled in this image?';
@@ -263,7 +264,9 @@ export namespace styleProviderQuiz {
doc.backgroundColor = '#' + hexSent.hexNumber;
} else {
const match = compareWords(input, StrCast(doc.quiz).trim());
- doc.backgroundColor = match ? '#11c249' : '#eb2d2d';
+ if (input) {
+ doc.backgroundColor = match ? '#11c249' : '#eb2d2d';
+ }
}
});
//this._loading = false;
@@ -281,7 +284,7 @@ export namespace styleProviderQuiz {
*/
function exitQuizMode(img: ImageBox) {
img.Document._quizMode = quizMode.NONE;
- DocListCast(img.Document._quizBoxes).forEach(box => {
+ DocListCast(img.Document.quizBoxes).forEach(box => {
box.hidden = true;
});
}