aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm
diff options
context:
space:
mode:
authorStanley Yip <stanley_yip@brown.edu>2020-02-10 20:02:43 -0500
committerStanley Yip <stanley_yip@brown.edu>2020-02-10 20:02:43 -0500
commitdc6453e27375a1b3d614a74b7fd1d83695f130d7 (patch)
treea459aebcd55d10e8d8013649bd1417aa3b5058f2 /src/client/views/collections/collectionFreeForm
parentdaa8898f70bd44d2716f1f0d3371a8435a3ff638 (diff)
some final stuff
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx9
-rw-r--r--src/client/views/collections/collectionFreeForm/MarqueeView.tsx14
2 files changed, 15 insertions, 8 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 53fe2b18c..4b1bb09a9 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -457,7 +457,6 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) {
const inkFields = inks.map(i => Cast(i.data, InkField));
CognitiveServices.Inking.Appliers.InterpretStrokes(inkFields.filter(i => i instanceof InkField).map(i => i!.inkData)).then((results) => {
const wordResults = results.filter((r: any) => r.category === "inkWord");
- console.log(wordResults);
for (const word of wordResults) {
const indices: number[] = word.strokeIds;
indices.forEach(i => {
@@ -467,13 +466,13 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) {
const uniqueColors: string[] = [];
Array.from(this._wordPalette.values()).forEach(c => uniqueColors.indexOf(c) === -1 && uniqueColors.push(c));
inks[i].alternativeColors = new List<string>(uniqueColors);
- if (this._wordPalette.has(word.recognizedText)) {
- inks[i].color = this._wordPalette.get(word.recognizedText);
+ if (this._wordPalette.has(word.recognizedText.toLowerCase())) {
+ inks[i].color = this._wordPalette.get(word.recognizedText.toLowerCase());
}
else {
for (const alt of word.alternates) {
- if (this._wordPalette.has(alt.recognizedString)) {
- inks[i].color = this._wordPalette.get(alt.recognizedString);
+ if (this._wordPalette.has(alt.recognizedString.toLowerCase())) {
+ inks[i].color = this._wordPalette.get(alt.recognizedString.toLowerCase());
break;
}
}
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
index 19a71012a..8591144c0 100644
--- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
+++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
@@ -375,7 +375,6 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
});
const colors = setDocs.map(sd => FieldValue(sd.color) as string);
const wordToColor = new Map<string, string>();
- console.log(sets);
sets.forEach((st: string, i: number) => {
const words = st.split(",");
words.forEach(word => {
@@ -386,11 +385,20 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
CognitiveServices.Inking.Appliers.InterpretStrokes(inkFields.filter(i => i instanceof InkField).map(i => i!.inkData)).then((results) => {
const wordResults = results.filter((r: any) => r.category === "inkWord");
console.log(wordResults);
+ console.log(results);
for (const word of wordResults) {
const indices: number[] = word.strokeIds;
indices.forEach(i => {
- if (wordToColor.has(word.recognizedText)) {
- inks[i].color = wordToColor.get(word.recognizedText);
+ if (wordToColor.has(word.recognizedText.toLowerCase())) {
+ inks[i].color = wordToColor.get(word.recognizedText.toLowerCase());
+ }
+ else {
+ for (const alt of word.alternates) {
+ if (wordToColor.has(alt.recognizedString.toLowerCase())) {
+ inks[i].color = wordToColor.get(alt.recognizedString.toLowerCase());
+ break;
+ }
+ }
}
})
}