diff options
| author | kimdahey <claire_kim1@brown.edu> | 2020-02-10 22:49:01 -0500 |
|---|---|---|
| committer | kimdahey <claire_kim1@brown.edu> | 2020-02-10 22:49:01 -0500 |
| commit | 9e9b775160e5d3b375c8c6e46c90f53291de6ee5 (patch) | |
| tree | 29e743121f522983c746a1acc46552153e4dad50 /src/client/views/collections/collectionFreeForm | |
| parent | 4b09b59dc31b089eada895fa0eabac95fd3931bd (diff) | |
| parent | dc6453e27375a1b3d614a74b7fd1d83695f130d7 (diff) | |
Merge branch 'pen' of https://github.com/browngraphicslab/Dash-Web into pull_pane
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 9 | ||||
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/MarqueeView.tsx | 14 |
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 85349b6e3..1f2cdaea4 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -460,7 +460,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 => { @@ -470,13 +469,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; + } + } } }) } |
