@@ -118,18 +118,16 @@ function checkloading() {
118
118
function domessage ( msg ) {
119
119
"use strict" ;
120
120
if ( timer !== null ) clearTimeout ( timer )
121
- var t1 = msclock ( )
121
+ var t1 = msclock ( )
122
122
var data = msg . content . data
123
123
if ( data != 'trigger' ) {
124
124
var msg = decode ( data )
125
125
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 )
133
131
}
134
132
135
133
// vpython.py calls onmessage, which responds through domessage, using send
@@ -150,7 +148,7 @@ function onmessage(msg) {
150
148
if ( timer !== undefined && timer !== null ) clearTimeout ( timer )
151
149
152
150
function send ( ) { // periodically send events and update_canvas and request object update
153
- "use strict" ;
151
+ "use strict" ;
154
152
var update = update_canvas ( )
155
153
if ( update !== null ) events = events . concat ( update )
156
154
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
169
167
// Should eventually have glowcomm.html, glowcom.js, and glowcommlab.js all import this common component.
170
168
171
169
window . __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
183
170
184
171
function msclock ( ) {
185
172
"use strict" ;
@@ -308,13 +295,11 @@ function send_pick(cvs, p, seg) {
308
295
events . push ( evt )
309
296
}
310
297
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" ;
313
300
var evt = { event : '_compound' , 'canvas' : cvs , 'pos' : [ pos . x , pos . y , pos . z ] ,
314
301
'size' : [ size . x , size . y , size . z ] , 'up' : [ up . x , up . y , up . z ] }
315
302
events . push ( evt )
316
- clearTimeout ( timer ) // Don't wait for next transmission to Python
317
- send ( )
318
303
}
319
304
320
305
var waitfor_canvas = null
@@ -460,7 +445,7 @@ var attrsb = {'a':'userzoom', 'b':'userspin', 'c':'range', 'd':'autoscale', 'e':
460
445
'p' :'left' , 'q' :'right' , 'r' :'top' , 's' :'bottom' , 't' :'_cloneid' ,
461
446
'u' :'logx' , 'v' :'logy' , 'w' :'dot' , 'x' :'dot_radius' ,
462
447
'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' }
464
449
465
450
// methods are X in {'m': '23X....'}
466
451
var 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', '
475
460
'marker_color' ]
476
461
477
462
var 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' ]
479
464
480
465
// patt gets idx and attr code; vpatt gets x,y,z of a vector
481
466
var patt = / ( \d + ) ( .) ( .* ) /
@@ -519,12 +504,8 @@ function decode(data) {
519
504
vs = [ Number ( val [ 1 ] ) , Number ( val [ 2 ] ) , Number ( val [ 3 ] ) , Number ( val [ 4 ] ) ]
520
505
}
521
506
} 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" )
528
509
} else if ( attr == 'rotate' ) { // angle,x,y,z,x,y,z
529
510
var temp = m [ 3 ]
530
511
val = [ ]
0 commit comments