From e4a9b55c40dffd9a9add9e814e3ce4611e2a318e Mon Sep 17 00:00:00 2001
From: bob <bcz@cs.brown.edu>
Date: Fri, 24 Jan 2020 18:12:05 -0500
Subject: fixed color setting from colorbox.

---
 src/client/views/InkingControl.tsx | 33 +++++----------------------------
 1 file changed, 5 insertions(+), 28 deletions(-)

(limited to 'src/client/views/InkingControl.tsx')

diff --git a/src/client/views/InkingControl.tsx b/src/client/views/InkingControl.tsx
index 10d013865..6cee702ee 100644
--- a/src/client/views/InkingControl.tsx
+++ b/src/client/views/InkingControl.tsx
@@ -2,14 +2,11 @@ import { action, computed, observable } from "mobx";
 import { ColorState } from 'react-color';
 import { Doc } from "../../new_fields/Doc";
 import { InkTool } from "../../new_fields/InkField";
-import { List } from "../../new_fields/List";
-import { listSpec } from "../../new_fields/Schema";
-import { Cast, NumCast, StrCast, FieldValue } from "../../new_fields/Types";
-import { Utils } from "../../Utils";
+import { FieldValue, NumCast, StrCast } from "../../new_fields/Types";
+import { CurrentUserUtils } from "../../server/authentication/models/current_user_utils";
 import { Scripting } from "../util/Scripting";
 import { SelectionManager } from "../util/SelectionManager";
-import { undoBatch, UndoManager } from "../util/UndoManager";
-import { CurrentUserUtils } from "../../server/authentication/models/current_user_utils";
+import { undoBatch } from "../util/UndoManager";
 import GestureOverlay from "./GestureOverlay";
 
 export class InkingControl {
@@ -41,32 +38,12 @@ export class InkingControl {
 
         if (InkingControl.Instance.selectedTool === InkTool.None) {
             const selected = SelectionManager.SelectedDocuments();
-            const oldColors = selected.map(view => {
+            selected.map(view => {
                 const targetDoc = view.props.Document.dragFactory instanceof Doc ? view.props.Document.dragFactory :
                     view.props.Document.layout instanceof Doc ? view.props.Document.layout :
                         view.props.Document.isTemplateForField ? view.props.Document : Doc.GetProto(view.props.Document);
-                const sel = window.getSelection();
-                if (StrCast(targetDoc.layout).indexOf("FormattedTextBox") !== -1 && (!sel || sel.toString() !== "")) {
-                    targetDoc.color = this._selectedColor;
-                    return {
-                        target: targetDoc,
-                        previous: StrCast(targetDoc.color)
-                    };
-                }
-                const oldColor = StrCast(targetDoc.backgroundColor);
-                let matchedColor = this._selectedColor;
-                targetDoc && (Doc.Layout(view.props.Document).backgroundColor = matchedColor);
-
-                return {
-                    target: targetDoc,
-                    previous: oldColor
-                };
+                targetDoc && (Doc.Layout(view.props.Document).backgroundColor = CurrentUserUtils.UserDocument.inkColor);
             });
-            //let captured = this._selectedColor;
-            // UndoManager.AddEvent({
-            //     undo: () => oldColors.forEach(pair => pair.target.backgroundColor = pair.previous),
-            //     redo: () => oldColors.forEach(pair => pair.target.backgroundColor = captured)
-            // });
         } else {
             CurrentUserUtils.ActivePen && (CurrentUserUtils.ActivePen.backgroundColor = this._selectedColor);
         }
-- 
cgit v1.2.3-70-g09d2

