From 3de5516fd4516654da1334ac9fecc2e568e15423 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Sun, 24 May 2020 16:55:39 -0400 Subject: fixes to how arrays are initialized and accessed in scipting box. --- src/client/views/nodes/ScriptingBox.tsx | 50 +++++++++++++-------------------- 1 file changed, 19 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index 6f02d8a16..73288eec4 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -49,37 +49,21 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent(value) } + set _paramsTypes(value: string[]) { this.dataDoc[this.props.fieldKey + "-paramsTypes"] = new List(value) } + set _paramsValues(value: string[]) { this.dataDoc[this.props.fieldKey + "-paramsValues"] = new List(value) } + set _paramsCollapsed(value: boolean[]) { this.dataDoc[this.props.fieldKey + "-paramsCollapsed"] = new List(value) } stopPropagation = (e: React.SyntheticEvent) => e.stopPropagation(); @@ -281,7 +265,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { const copy = Doc.MakeCopy(this.rootDoc, true); - copy.x = Number(this.dataDoc._width) + Number(this.dataDoc.x); + copy.x = NumCast(this.dataDoc._width) + NumCast(this.dataDoc.x); this.props.addDocument?.(copy); } @@ -311,7 +295,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent(value.split(";").filter(s => s !== " ")); this.compileParams.push.apply(this.compileParams, par); + if (this._paramsNames === undefined) this._paramsNames = []; + if (this._paramsTypes === undefined) this._paramsTypes = []; + if (this._paramsValues === undefined) this._paramsValues = []; + if (this._paramsCollapsed === undefined) this._paramsCollapsed = []; this._paramsNames.push(parameter[0].trim()); this._paramsTypes.push(parameter[1].trim()); this._paramsValues.push("undefined"); @@ -395,7 +383,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent + const settingParams = !this._paramsNames ? (null) : this._paramsNames.map((parameter: string, i: number) =>
e.key === "Enter" && this._overlayDisposer?.()} @@ -644,7 +632,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent this.props.isSelected(true) && e.stopPropagation()}> - {!!!this._applied ?
+ {!this._applied ?
{scriptingInputs}
: null} @@ -654,7 +642,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent
: (null)} - {!!!this._applied ?
+ {!this._applied ?
{scriptingTools}
: null} -- cgit v1.2.3-70-g09d2