From 755ea0668b559a2ae5f2c6dac86261db86e9ad2e Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Fri, 22 May 2020 11:27:07 -0500 Subject: fixed boolean types in script --- src/client/views/nodes/ScriptingBox.tsx | 75 +++++++++++++++++---------------- 1 file changed, 38 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index 4ac8d0fc7..902c42a07 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -223,7 +223,6 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { - console.log("selected"); this.stopPropagation; this.dataDoc[name] = val; this._paramsValues[index] = val; @@ -231,7 +230,6 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { - console.log("hello"); if (this._paramsCollapsed[num]) { this._paramsCollapsed[num] = false; } else { @@ -239,6 +237,18 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { + this.stopPropagation; + if (val) { + this._paramsValues[index] = "true"; + this.dataDoc[name] = true; + } else { + this._paramsValues[index] = "false"; + this.dataDoc[name] = false; + } + } + render() { @@ -487,41 +497,32 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent {parameter + ":" + this._paramsTypes[i] + " = "} -
- StrCast(this._paramsValues[i])} - SetValue={action((value: string) => { - if (value !== "" && value !== " ") { - if (value.trim() === "true") { - console.log("hello"); - this._errorMessage = ""; - // does not set this - this.dataDoc[parameter] = true; - // sets this - this._paramsValues[i] = "true"; - return true; - } else { - if (value.trim() === "false") { - this._errorMessage = ""; - this.dataDoc[parameter] = false; - this._paramsValues[i] = "false"; - return true; - } else { - this._errorMessage = "not a boolean"; - return false; - } - } - } else { - return false; - } - })} - /> +
+
+
+ +
+
: null} -- cgit v1.2.3-70-g09d2