diff options
| author | Stanley Yip <stanley_yip@brown.edu> | 2020-04-28 18:27:17 -0700 | 
|---|---|---|
| committer | Stanley Yip <stanley_yip@brown.edu> | 2020-04-28 18:27:17 -0700 | 
| commit | dfa9b765a2918e2e4613d57ac70370b2dc292726 (patch) | |
| tree | fc2b3bab40fc3bac987561456fff5b1fa570aebc /src/client/views/InkingControl.tsx | |
| parent | 55d1ea38c1355ef97efedd6c1fbdbc29d7b5d821 (diff) | |
| parent | 6b2896756c55727ed397c223187cb03fe8a51a59 (diff) | |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into snapper
Diffstat (limited to 'src/client/views/InkingControl.tsx')
| -rw-r--r-- | src/client/views/InkingControl.tsx | 20 | 
1 files changed, 10 insertions, 10 deletions
| diff --git a/src/client/views/InkingControl.tsx b/src/client/views/InkingControl.tsx index 645c7fa54..70ea955e1 100644 --- a/src/client/views/InkingControl.tsx +++ b/src/client/views/InkingControl.tsx @@ -8,13 +8,13 @@ import { Scripting } from "../util/Scripting";  import { SelectionManager } from "../util/SelectionManager";  import { undoBatch } from "../util/UndoManager";  import GestureOverlay from "./GestureOverlay"; -import { FormattedTextBox } from "./nodes/FormattedTextBox"; +import { FormattedTextBox } from "./nodes/formattedText/FormattedTextBox";  export class InkingControl {      @observable static Instance: InkingControl; -    @computed private get _selectedTool(): InkTool { return FieldValue(NumCast(CurrentUserUtils.UserDocument.inkTool)) ?? InkTool.None; } -    @computed private get _selectedColor(): string { return GestureOverlay.Instance.Color ?? FieldValue(StrCast(CurrentUserUtils.UserDocument.inkColor)) ?? "rgb(244, 67, 54)"; } -    @computed private get _selectedWidth(): string { return GestureOverlay.Instance.Width?.toString() ?? FieldValue(StrCast(CurrentUserUtils.UserDocument.inkWidth)) ?? "5"; } +    @computed private get _selectedTool(): InkTool { return FieldValue(NumCast(Doc.UserDoc().inkTool)) ?? InkTool.None; } +    @computed private get _selectedColor(): string { return GestureOverlay.Instance.Color ?? FieldValue(StrCast(Doc.UserDoc().inkColor)) ?? "rgb(244, 67, 54)"; } +    @computed private get _selectedWidth(): string { return GestureOverlay.Instance.Width?.toString() ?? FieldValue(StrCast(Doc.UserDoc().inkWidth)) ?? "5"; }      @observable public _open: boolean = false;      constructor() { @@ -23,7 +23,7 @@ export class InkingControl {      switchTool = action((tool: InkTool): void => {          // this._selectedTool = tool; -        CurrentUserUtils.UserDocument.inkTool = tool; +        Doc.UserDoc().inkTool = tool;      });      decimalToHexString(number: number) {          if (number < 0) { @@ -34,7 +34,7 @@ export class InkingControl {      @undoBatch      switchColor = action((color: ColorState): void => { -        CurrentUserUtils.UserDocument.inkColor = color.hex + (color.rgb.a !== undefined ? this.decimalToHexString(Math.round(color.rgb.a * 255)) : "ff"); +        Doc.UserDoc().inkColor = color.hex + (color.rgb.a !== undefined ? this.decimalToHexString(Math.round(color.rgb.a * 255)) : "ff");          if (InkingControl.Instance.selectedTool === InkTool.None) {              const selected = SelectionManager.SelectedDocuments(); @@ -44,9 +44,9 @@ export class InkingControl {                          view.props.Document.isTemplateForField ? view.props.Document : Doc.GetProto(view.props.Document);                  if (targetDoc) {                      if (StrCast(Doc.Layout(view.props.Document).layout).indexOf("FormattedTextBox") !== -1 && FormattedTextBox.HadSelection) { -                        Doc.Layout(view.props.Document).color = CurrentUserUtils.UserDocument.inkColor; +                        Doc.Layout(view.props.Document).color = Doc.UserDoc().inkColor;                      } else { -                        Doc.Layout(view.props.Document)._backgroundColor = CurrentUserUtils.UserDocument.inkColor; // '_backgroundColor' is template specific.  'backgroundColor' would apply to all templates, but has no UI at the moment +                        Doc.Layout(view.props.Document)._backgroundColor = Doc.UserDoc().inkColor; // '_backgroundColor' is template specific.  'backgroundColor' would apply to all templates, but has no UI at the moment                      }                  }              }); @@ -57,7 +57,7 @@ export class InkingControl {      @action      switchWidth = (width: string): void => {          // this._selectedWidth = width; -        CurrentUserUtils.UserDocument.inkWidth = width; +        Doc.UserDoc().inkWidth = width;      }      @computed @@ -73,7 +73,7 @@ export class InkingControl {      @action      updateSelectedColor(value: string) {          // this._selectedColor = value; -        CurrentUserUtils.UserDocument.inkColor = value; +        Doc.UserDoc().inkColor = value;      }      @computed | 
