comparison nodejs/testcase.js @ 749:ed59e659a202

Implement binding for hide/show for shapes and coords
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 25 Aug 2010 19:37:52 +0800
parents 56a5e08cd8af
children cceac4ba259e
comparison
equal deleted inserted replaced
748:56a5e08cd8af 749:ed59e659a202
39 var rect = mb_rt.rect_new(40, 40, 100, 100, 10, 10); 39 var rect = mb_rt.rect_new(40, 40, 100, 100, 10, 10);
40 sys.puts(mb_rt.paint_color_new); 40 sys.puts(mb_rt.paint_color_new);
41 var paint = mb_rt.paint_color_new(1, 0.5, 0.5, 0.5); 41 var paint = mb_rt.paint_color_new(1, 0.5, 0.5, 0.5);
42 paint.fill(rect); 42 paint.fill(rect);
43 root.add_shape(rect); 43 root.add_shape(rect);
44
45 /* test hide of shapes */
46 var sw = 1;
47 setInterval(function() {
48 if(sw) {
49 rect.hide();
50 sw = 0;
51 } else {
52 rect.show();
53 sw = 1;
54 }
55 }, 1000);
56
57 /* test hide of coord */
58 var cw = 1;
59 setInterval(function() {
60 if(sw) {
61 coord.hide();
62 cw = 0;
63 } else {
64 coord.show();
65 cw = 1;
66 }
67 }, 3000);
44 68
45 /* test removing a coord */ 69 /* test removing a coord */
46 var rm_coord = mb_rt.coord_new(root); 70 var rm_coord = mb_rt.coord_new(root);
47 var rm_rect1 = mb_rt.rect_new(150, 150, 50, 50, 10, 10); 71 var rm_rect1 = mb_rt.rect_new(150, 150, 50, 50, 10, 10);
48 paint.fill(rm_rect1); 72 paint.fill(rm_rect1);