|
454 | 454 | vs = [Number(val[1]), Number(val[2]), Number(val[3]), Number(val[4])]
|
455 | 455 | }
|
456 | 456 | } else if (textattrs.indexOf(attr) > -1) {
|
457 |
| - if (attr == 'choices') { // menu choices to be wrapped in a list |
| 457 | + if (attr == 'choices') { // menu choices are wrapped in a list |
458 | 458 | val = m[3].slice(2,-2)
|
459 | 459 | val = val.replace(/'/g, '') // remove quotes
|
460 |
| - val = val.replace(/,/g, '') // remove commas |
461 |
| - let s = val.split(' ') |
| 460 | + let s = val.split(',') |
462 | 461 | val = []
|
463 |
| - let a |
464 |
| - for (a of s) {val.push(a)} |
| 462 | + for (let a of s) {val.push(a)} |
465 | 463 | } else {
|
466 | 464 | // '\n' doesn't survive JSON transmission, so in vpython.py we replace '\n' with '<br>'
|
467 | 465 | val = m[3].replace(/<br>/g, "\n")
|
|
541 | 539 | for (var i in data[d]) console.log(i, JSON.stringify(data[d][i]))
|
542 | 540 | }
|
543 | 541 | */
|
544 |
| - |
545 | 542 |
|
546 | 543 | if (data.cmds !== undefined && data.cmds.length > 0) handle_cmds(data.cmds)
|
547 | 544 | if (data.methods !== undefined && data.methods.length > 0) handle_methods(data.methods)
|
|
800 | 797 | cfg.objName = obj
|
801 | 798 | cfg.bind = control_handler
|
802 | 799 | cfg = fix_location(cfg)
|
| 800 | + console.log('menu cfg', cfg) |
803 | 801 | glowObjs[idx] = menu(cfg)
|
804 | 802 | if (cfg['selected'] === 'None') {
|
805 | 803 | cfg['selected'] = null
|
|
809 | 807 | default:
|
810 | 808 | console.log("Unable to create object")
|
811 | 809 | }
|
812 |
| - |
813 |
| - /* |
814 |
| - if (obj === 'redisplay') { |
815 |
| - var c = document.getElementById(cmd.sceneId) |
816 |
| - if (c !== null) { |
817 |
| - var scn = "#" + cmd.sceneId |
818 |
| - glowObjs[idx].sceneclone = $(scn).clone(true,true) |
819 |
| - //document.getElementById('glowscript2').appendChild(c) |
820 |
| - //document.getElementById('glowscript2').replaceWith(c) |
821 |
| - $('#glowscript2').replaceWith(c) |
822 |
| - c = document.getElementById(cmd.sceneId) |
823 |
| - var cont = scn + " .glowscript" |
824 |
| - window.__context = { glowscript_container: $(cont) } |
825 |
| - } else { |
826 |
| - window.__context = { glowscript_container: $("#glowscript").removeAttr("id") } |
827 |
| - var newcnvs = canvas() |
828 |
| - for (var obj in glowObjs[idx].objects) { |
829 |
| - var o = glowObjs[idx].objects[obj] |
830 |
| - if ((o.constructor.name !== 'curve') && (o.constructor.name !== 'points')) { |
831 |
| - glowObjs[o.gidx] = o.clone({canvas: newcnvs}) |
832 |
| - var olen = newcnvs.objects.length |
833 |
| - if (olen > 0) { |
834 |
| - newcnvs.objects[olen - 1].gidx = o.gidx |
835 |
| - } |
836 |
| - } |
837 |
| - } |
838 |
| - glowObjs[idx] = newcnvs |
839 |
| - $("#glowscript2").attr("id",cmd.sceneId) |
840 |
| - } |
841 |
| - } else if (obj === 'delete') { |
842 |
| - b = glowObjs[idx] |
843 |
| - if ((b !== null) || (b.visible !== undefined)) { |
844 |
| - b.visible = false |
845 |
| - } |
846 |
| - glowObjs[idx] = null |
847 |
| - } else if (obj === 'heartbeat') { |
848 |
| - //console.log("heartbeat") |
849 |
| - } else if (obj === 'debug') { |
850 |
| - console.log("debug : ", cmd) |
851 |
| - } |
852 |
| - */ |
853 | 810 | } // end of cmds (constructors and special data)
|
854 | 811 | }
|
855 | 812 |
|
|
931 | 888 | var obj = glowObjs[idx]
|
932 | 889 | var attr = cmd['attr']
|
933 | 890 | var val = cmd['val']
|
| 891 | + console.log(obj, attr, val) |
934 | 892 | var triangle_quad = ['v0', 'v1', 'v2', 'v3']
|
935 | 893 | // vector attrs in attach_arrow have arbitrary names, so check for length 3 array instead
|
936 | 894 | if (val instanceof vec) {
|
|
0 commit comments