@@ -118,18 +118,16 @@ function checkloading() {
118118function domessage ( msg ) {
119119 "use strict" ;
120120 if ( timer !== null ) clearTimeout ( timer )
121- var t1 = msclock ( )
121+ var t1 = msclock ( )
122122 var data = msg . content . data
123123 if ( data != 'trigger' ) {
124124 var msg = decode ( data )
125125 handler ( msg )
126- }
127- if ( timer !== null ) { // if not a wait situation as with compound/extrusion/text
128- var t2 = msclock ( )
129- var dt = Math . floor ( t1 + interval - t2 ) // attempt to keep the time between renders constant
130- if ( dt < 15 ) dt = 0 // becaause setTimeout is inaccurate for small dt's
131- timer = setTimeout ( send , dt )
132- }
126+ }
127+ var t2 = msclock ( )
128+ var dt = Math . floor ( t1 + interval - t2 ) // attempt to keep the time between renders constant
129+ if ( dt < 15 ) dt = 0 // becaause setTimeout is inaccurate for small dt's
130+ timer = setTimeout ( send , dt )
133131}
134132
135133// vpython.py calls onmessage, which responds through domessage, using send
@@ -150,7 +148,7 @@ function onmessage(msg) {
150148if ( timer !== undefined && timer !== null ) clearTimeout ( timer )
151149
152150function send ( ) { // periodically send events and update_canvas and request object update
153- "use strict" ;
151+ "use strict" ;
154152 var update = update_canvas ( )
155153 if ( update !== null ) events = events . concat ( update )
156154 if ( events . length === 0 ) events = [ { event :'update_canvas' , 'trigger' :1 } ]
@@ -169,17 +167,6 @@ function send() { // periodically send events and update_canvas and request obje
169167// Should eventually have glowcomm.html, glowcom.js, and glowcommlab.js all import this common component.
170168
171169window . __GSlang = "vpython"
172- box = vp_box
173- sphere = vp_sphere
174- simple_sphere = vp_simple_sphere
175- cylinder = vp_cylinder
176- pyramid = vp_pyramid
177- cone = vp_cone
178- helix = vp_helix
179- ellipsoid = vp_ellipsoid
180- ring = vp_ring
181- arrow = vp_arrow
182- compound = vp_compound
183170
184171function msclock ( ) {
185172 "use strict" ;
@@ -308,13 +295,11 @@ function send_pick(cvs, p, seg) {
308295 events . push ( evt )
309296}
310297
311- function send_compound ( cvs , pos , size , up ) { // compound, extrusion, 3D text
312- "use strict" ;
298+ function send_compound ( cvs , pos , size , up ) {
299+ "use strict" ;
313300 var evt = { event : '_compound' , 'canvas' : cvs , 'pos' : [ pos . x , pos . y , pos . z ] ,
314301 'size' : [ size . x , size . y , size . z ] , 'up' : [ up . x , up . y , up . z ] }
315302 events . push ( evt )
316- clearTimeout ( timer ) // Don't wait for next transmission to Python
317- send ( )
318303}
319304
320305var waitfor_canvas = null
@@ -460,7 +445,7 @@ var attrsb = {'a':'userzoom', 'b':'userspin', 'c':'range', 'd':'autoscale', 'e':
460445 'p' :'left' , 'q' :'right' , 'r' :'top' , 's' :'bottom' , 't' :'_cloneid' ,
461446 'u' :'logx' , 'v' :'logy' , 'w' :'dot' , 'x' :'dot_radius' ,
462447 'y' :'markers' , 'z' :'legend' , 'A' :'label' , 'B' :'delta' , 'C' :'marker_color' ,
463- 'D' :'size_units' , 'E' :'userpan' , 'F' :'scroll' , 'G' : 'choices' }
448+ 'D' :'size_units' , 'E' :'userpan' , 'F' :'scroll' }
464449
465450// methods are X in {'m': '23X....'}
466451var methods = { 'a' :'select' , 'b' :'pos' , 'c' :'start' , 'd' :'stop' , 'f' :'clear' , // unused eghijklmnopvxyzCDFAB
@@ -475,7 +460,7 @@ var vecattrs = ['pos', 'up', 'color', 'trail_color', 'axis', 'size', 'origin', '
475460 'marker_color' ]
476461
477462var textattrs = [ 'text' , 'align' , 'caption' , 'title' , 'title_align' , 'xtitle' , 'ytitle' , 'selected' , 'capture' ,
478- 'label' , 'append_to_caption' , 'append_to_title' , 'bind' , 'unbind' , 'pause' , 'GSprint' , 'choices' ]
463+ 'label' , 'append_to_caption' , 'append_to_title' , 'bind' , 'unbind' , 'pause' , 'GSprint' ]
479464
480465// patt gets idx and attr code; vpatt gets x,y,z of a vector
481466var patt = / ( \d + ) ( .) ( .* ) /
@@ -519,12 +504,8 @@ function decode(data) {
519504 vs = [ Number ( val [ 1 ] ) , Number ( val [ 2 ] ) , Number ( val [ 3 ] ) , Number ( val [ 4 ] ) ]
520505 }
521506 } else if ( textattrs . indexOf ( attr ) > - 1 ) {
522- if ( attr == 'choices' ) { // menu choices to be wrapped in a list
523- val = m [ 3 ] . split ( ' ' )
524- } else {
525- // '\n' doesn't survive JSON transmission, so in vpython.py we replace '\n' with '<br>'
526- val = m [ 3 ] . replace ( / < b r > / g, "\n" )
527- }
507+ // '\n' doesn't survive JSON transmission, so in vpython.py we replace '\n' with '<br>'
508+ val = m [ 3 ] . replace ( / < b r > / g, "\n" )
528509 } else if ( attr == 'rotate' ) { // angle,x,y,z,x,y,z
529510 var temp = m [ 3 ]
530511 val = [ ]
0 commit comments