From c17e8ebf0454ad2067ab6556355c5bb69b7cf41e Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Tue, 14 Apr 2020 17:36:27 -0500 Subject: added onSave --- src/client/views/nodes/ScriptingBox.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index 93956592f..4159bbed4 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -38,6 +38,22 @@ export class ScriptingBox extends DocAnnotatableComponent { + const result = CompileScript(this.rawScript, {}); + this._errorMessage = ""; + if (result.compiled) { + this._errorMessage = ""; + this.props.Document.data = new ScriptField(result); + + //button + } + else { + // + } + this.props.Document.documentText = this.rawScript; + } + @action onCompile = () => { const params = this.compileParams.reduce((o: ScriptParam, p: string) => { o[p] = "any"; return o; }, {} as ScriptParam); -- cgit v1.2.3-70-g09d2 From 15316764dfcc1d230efdc6cd2f2f0bd47be3efd8 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Tue, 14 Apr 2020 18:32:27 -0500 Subject: add on finish button and change button drag out --- package-lock.json | 49 +++++++++++++++++++++---------- src/.DS_Store | Bin 6148 -> 8196 bytes src/client/documents/Documents.ts | 7 ++++- src/client/views/nodes/ScriptingBox.scss | 12 ++++++-- src/client/views/nodes/ScriptingBox.tsx | 17 ++++------- 5 files changed, 55 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/package-lock.json b/package-lock.json index 11eaaddd6..f40dc7b0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -764,7 +764,7 @@ }, "@types/passport": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.2.tgz", "integrity": "sha512-Pf39AYKf8q+YoONym3150cEwfUD66dtwHJWvbeOzKxnA0GZZ/vAXhNWv9vMhKyRQBQZiQyWQnhYBEBlKW6G8wg==", "requires": { "@types/express": "*" @@ -5629,7 +5629,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -5647,11 +5648,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5664,15 +5667,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -5775,7 +5781,8 @@ }, "inherits": { "version": "2.0.4", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -5785,6 +5792,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5797,17 +5805,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.9.0", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -5824,6 +5835,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -5904,7 +5916,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -5914,6 +5927,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -5989,7 +6003,8 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -6019,6 +6034,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -6036,6 +6052,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -6074,11 +6091,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.1.1", - "bundled": true + "bundled": true, + "optional": true } } }, @@ -14395,7 +14414,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "requires": { "core-util-is": "~1.0.0", @@ -16009,7 +16028,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -18322,7 +18341,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "requires": { "string-width": "^1.0.1", diff --git a/src/.DS_Store b/src/.DS_Store index 5b35884bd..942a5672b 100644 Binary files a/src/.DS_Store and b/src/.DS_Store differ 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 { + 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 + {this.rootDoc.layoutKey === "layout_onClick" ? : null} ); -- cgit v1.2.3-70-g09d2 From a261ab5e9697277bec029803f1fa0c890f0c8fd5 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Sat, 18 Apr 2020 17:47:03 -0500 Subject: fix button UI on scripting, changed button onClick --- src/client/documents/Documents.ts | 12 ++++++------ src/client/views/nodes/ScriptingBox.scss | 2 +- src/client/views/nodes/ScriptingBox.tsx | 10 ++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index aea4867cd..450f342ca 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -648,12 +648,12 @@ export namespace Docs { } export function ButtonDocument(options?: DocumentOptions) { - 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; + // 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 InstanceFromProto(Prototypes.get(DocumentType.BUTTON), undefined, { ...(options || {}), "onClick-rawScript": "-script-" }); } export function SliderDocument(options?: DocumentOptions) { diff --git a/src/client/views/nodes/ScriptingBox.scss b/src/client/views/nodes/ScriptingBox.scss index 3dfd65bc1..ffef1410d 100644 --- a/src/client/views/nodes/ScriptingBox.scss +++ b/src/client/views/nodes/ScriptingBox.scss @@ -34,7 +34,7 @@ height: 30px; .scriptingBox-button { - width: 33%; + width: 50%; resize: auto; } diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index bd20f9f67..317c48c1a 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -84,7 +84,9 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent; return (
this.props.isSelected(true) && e.stopPropagation()}> +
this.props.isSelected(true) && e.stopPropagation()} >