Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _addVariable (): void {
// Create window
const window = new Window('GraphToolAddVariable');
window.buttons = ['Ok', 'Cancel'];
window.width = 450;
window.height = 170;
window.body = `<div style="width: 100%; height: 100%;" id="GRAPH-TOOL-ADD-VARIABLE"></div>`;
window.open();
// Create form
const form = new Form('GRAPH-TOOL-ADD-VARIABLE');
form.fields = [
{ name: 'name', type: 'text', required: true, html: { span: 10, caption: 'The name of the variable.' } },
{ name: 'type', type: 'list', required: true, html: { span: 10, caption: 'Format' }, options: {
items: ['String', 'Boolean', 'Number', 'Vector 2D', 'Vector 3D', 'Vector 4D']
} }
];
form.build('GRAPH-TOOL-ADD-VARIABLE');
form.element.record['name'] = 'My Variable';
private async _editVariable (id: number): Promise {
const v = this.object.graph.variables[id];
// Create window
const window = new Window('GraphToolAddVariable');
window.buttons = ['Ok', 'Cancel'];
window.width = 450;
window.height = 170;
window.body = `<div style="width: 100%; height: 100%;" id="GRAPH-TOOL-EDIT-VARIABLE"></div>`;
window.open();
// Create form
const form = new Form('GRAPH-TOOL-EDIT-VARIABLE');
form.fields = [
{ name: 'name', type: 'text', required: true, html: { span: 10, caption: 'The name of the variable.' } }
];
switch (this._getType(v.value)) {
case 'String':
form.fields.push({ name: 'value', type: 'text', required: true, html: { span: 10, caption: 'Value' } });
break;
case 'Number':