From 68f613b5e762649b743059e494e9307eb103ff0d Mon Sep 17 00:00:00 2001
From: Tyler Schicke <tyler_schicke@brown.edu>
Date: Thu, 8 Aug 2019 16:15:22 -0400
Subject: Fixed per field write modes

---
 src/client/views/MainView.tsx | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

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

diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index ddb023aca..7629a0906 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -435,6 +435,7 @@ export class MainView extends React.Component {
     }
 
 
+    private mode: DocServer.WriteMode = DocServer.WriteMode.Always;
     @observable private _colorPickerDisplay = false;
     /* for the expandable add nodes menu. Not included with the miscbuttons because once it expands it expands the whole div with it, making canvas interactions limited. */
     nodesMenu() {
@@ -479,15 +480,13 @@ export class MainView extends React.Component {
                             </button>
                         </div></li>)}
                     <li key="undoTest"><button className="add-button round-button" title="Click if undo isn't working" onClick={() => UndoManager.TraceOpenBatches()}><FontAwesomeIcon icon="exclamation" size="sm" /></button></li>
-                    <li key="test"><button className="add-button round-button" title="asdf" onClick={(() => {
-                        let state = DocServer.WriteMode.Always;
-                        return () => {
-                            state++;
-                            state = state % 3;
-                            DocServer.setFieldWriteMode("x", state);
-                            DocServer.setFieldWriteMode("y", state);
-                        };
-                    })()}><FontAwesomeIcon icon="exclamation" size="sm" /></button></li>
+                    <li key="test"><button className="add-button round-button" title="asdf" onClick={() => {
+                        this.mode++;
+                        this.mode = this.mode % 3;
+                        console.log(DocServer.WriteMode[this.mode]);
+                        DocServer.setFieldWriteMode("x", this.mode);
+                        DocServer.setFieldWriteMode("y", this.mode);
+                    }}><FontAwesomeIcon icon="exclamation" size="sm" /></button></li>
                     <li key="color"><button className="add-button round-button" title="Select Color" style={{ zIndex: 1000 }} onClick={() => this.toggleColorPicker()}><div className="toolbar-color-button" style={{ backgroundColor: InkingControl.Instance.selectedColor }} >
                         <div className="toolbar-color-picker" onClick={this.onColorClick} style={this._colorPickerDisplay ? { color: "black", display: "block" } : { color: "black", display: "none" }}>
                             <SketchPicker color={InkingControl.Instance.selectedColor} onChange={InkingControl.Instance.switchColor} />
-- 
cgit v1.2.3-70-g09d2

