diff options
author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-04-14 18:32:27 -0500 |
---|---|---|
committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-04-14 18:32:27 -0500 |
commit | 15316764dfcc1d230efdc6cd2f2f0bd47be3efd8 (patch) | |
tree | 1d3330a863fc88bba4e81a7801c101d915aa6d2b /src | |
parent | e7469b5454acd59238dfeb5a7e023a591a23d852 (diff) |
add on finish button and change button drag out
Diffstat (limited to 'src')
-rw-r--r-- | src/.DS_Store | bin | 6148 -> 8196 bytes | |||
-rw-r--r-- | src/client/documents/Documents.ts | 7 | ||||
-rw-r--r-- | src/client/views/nodes/ScriptingBox.scss | 12 | ||||
-rw-r--r-- | src/client/views/nodes/ScriptingBox.tsx | 17 |
4 files changed, 21 insertions, 15 deletions
diff --git a/src/.DS_Store b/src/.DS_Store Binary files differindex 5b35884bd..942a5672b 100644 --- a/src/.DS_Store +++ b/src/.DS_Store diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index e6f3b21ca..aea4867cd 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -648,7 +648,12 @@ export namespace Docs { } export function ButtonDocument(options?: DocumentOptions) { - return InstanceFromProto(Prototypes.get(DocumentType.BUTTON), undefined, { ...(options || {}), "onClick-rawScript": "-script-" }); + const btn = InstanceFromProto(Prototypes.get(DocumentType.BUTTON), undefined, { ...(options || {}), "onClick-rawScript": "-script-" }); + btn.layoutKey = "layout_onClick"; + btn.height = 250; + btn.width = 200; + btn.layout_onClick = ScriptingBox.LayoutString("onClick"); + return btn; } export function SliderDocument(options?: DocumentOptions) { diff --git a/src/client/views/nodes/ScriptingBox.scss b/src/client/views/nodes/ScriptingBox.scss index 678a1a22d..3dfd65bc1 100644 --- a/src/client/views/nodes/ScriptingBox.scss +++ b/src/client/views/nodes/ScriptingBox.scss @@ -6,16 +6,20 @@ pointer-events: all; background-color: rgb(241, 239, 235); padding: 10px; + .scriptingBox-inputDiv { display: flex; flex-direction: column; height: calc(100% - 30px); + .scriptingBox-errorMessage { overflow: auto; } + .scripting-params { background: "beige"; } + .scriptingBox-textArea { width: 100%; height: 100%; @@ -28,9 +32,11 @@ .scriptingBox-toolbar { width: 100%; height: 30px; + .scriptingBox-button { - width: 50% + width: 33%; + resize: auto; + } } -} - +}
\ No newline at end of file diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index 552086790..7fcb9a8d0 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -41,18 +41,11 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc componentWillUnmount() { this._overlayDisposer?.(); } @action - onSave = () => { + onFinish = () => { const result = CompileScript(this.rawScript, {}); - this._errorMessage = ""; - if (result.compiled) { - this._errorMessage = ""; - this.props.Document.data = new ScriptField(result); - - //button - } - else { - // - } + this.rootDoc.layoutKey = "layout"; + this.rootDoc.height = 50; + this.rootDoc.width = 100; this.props.Document.documentText = this.rawScript; } @@ -106,6 +99,8 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc <div className="scriptingBox-toolbar"> <button className="scriptingBox-button" onPointerDown={e => { this.onCompile(); e.stopPropagation(); }}>Compile</button> <button className="scriptingBox-button" onPointerDown={e => { this.onRun(); e.stopPropagation(); }}>Run</button> + {this.rootDoc.layoutKey === "layout_onClick" ? <button className="scriptingBox-button" + onPointerDown={e => { this.onFinish(); e.stopPropagation(); }}>Finish</button> : null} </div> </div> ); |