diff options
| author | geireann <geireann.lindfield@gmail.com> | 2021-08-24 19:06:43 -0400 |
|---|---|---|
| committer | geireann <geireann.lindfield@gmail.com> | 2021-08-24 19:06:43 -0400 |
| commit | 0c5a95f37e91a07041699514155fd214f544a0de (patch) | |
| tree | 58fe2ae043972171f2a91cc277c42a0e68acd773 /src/client/views/nodes/button/FontIconBox.tsx | |
| parent | 325d3a8c931cb9ff7eadfa29603a3c7ca747911b (diff) | |
updates
Diffstat (limited to 'src/client/views/nodes/button/FontIconBox.tsx')
| -rw-r--r-- | src/client/views/nodes/button/FontIconBox.tsx | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/client/views/nodes/button/FontIconBox.tsx b/src/client/views/nodes/button/FontIconBox.tsx index 4778c2f10..744064b9f 100644 --- a/src/client/views/nodes/button/FontIconBox.tsx +++ b/src/client/views/nodes/button/FontIconBox.tsx @@ -25,6 +25,7 @@ import { StyleProp } from '../../StyleProvider'; import { FieldView, FieldViewProps } from '.././FieldView'; import { RichTextMenu } from '../formattedText/RichTextMenu'; import './FontIconBox.scss'; +import { SetActiveInkWidth } from '../../InkingStroke'; const FontIconSchema = createSchema({ icon: "string", }); @@ -177,7 +178,7 @@ export class FontIconBox extends DocComponent<ButtonProps, FontIconDocument>(Fon {this.rootDoc.dropDownOpen ? <div> <div className="menuButton-dropdownList" - style={{ left: 0 }}> + style={{ left: "25%" }}> {list} </div> <div className="dropbox-background" onClick={(e) => { e.stopPropagation(); this.rootDoc.dropDownOpen = false; }} /> @@ -383,12 +384,19 @@ export class FontIconBox extends DocComponent<ButtonProps, FontIconDocument>(Fon const switchToggle: boolean = BoolCast(this.rootDoc.switchToggle); // Script for running the toggle - const script: string = StrCast(this.rootDoc.script) + "()"; + const script: string = StrCast(this.rootDoc.script); + // Script for checking the outcome of the toggle - const checkScript: string = StrCast(this.rootDoc.script) + "(true)"; + let checkScript:string; + if (StrCast(this.rootDoc.script).includes("(")){ + checkScript = StrCast(this.rootDoc.script) + + } else { + checkScript = StrCast(this.rootDoc.script) + "(true)"; + } // Function to run the script - const runScript = () => ScriptField.MakeScript(script)?.script.run(); + const runScript = () => ScriptField.MakeScript(script + "()")?.script.run(); const checkResult = ScriptField.MakeScript(checkScript)?.script.run().result; // Colors @@ -456,9 +464,10 @@ export class FontIconBox extends DocComponent<ButtonProps, FontIconDocument>(Fon return ( <div className={`menuButton ${this.type}`}> - <FontAwesomeIcon className={`fontIconBox-icon-${this.type}`} icon={"lock"} /> + HELLO + {/* <FontAwesomeIcon className={`fontIconBox-icon-${this.type}`} icon={"lock"} /> <EditableView GetValue={() => ""} SetValue={setValue} contents="..."> - </EditableView> + </EditableView> */} </div> ); } @@ -492,6 +501,7 @@ export class FontIconBox extends DocComponent<ButtonProps, FontIconDocument>(Fon switch (this.type) { case ButtonType.EditableText: + console.log("Editable text"); button = this.editableText; case ButtonType.NumberButton: button = this.numberButton; @@ -657,7 +667,11 @@ Scripting.addGlobal(function setActiveInkTool(tool: InkTool, checkResult?: boole return Doc.UserDoc().activeInkTool === tool; } if (tool) { - Doc.UserDoc().activeInkTool = tool; + if (Doc.UserDoc().activeInkTool === tool){ + Doc.UserDoc().activeInkTool = InkTool.None; + } else { + Doc.UserDoc().activeInkTool = tool; + } } else { Doc.UserDoc().activeInkTool = InkTool.None; } @@ -668,6 +682,6 @@ Scripting.addGlobal(function setStrokeWidth(width: number, checkResult?: boolean const width: number = NumCast(Doc.UserDoc().activeInkWidth); return width; } - console.log("[width]: " + width); - Doc.UserDoc().activeInkWidth = width; + SetActiveInkWidth(StrCast(width)); + SelectionManager.Views().filter(i => StrCast(i.rootDoc.type) === DocumentType.INK).map(i => i.rootDoc.strokeWidth = Number(width)); });
\ No newline at end of file |
