comparison nodejs/testcase.js @ 748:56a5e08cd8af

Make shapes can be removed from the tree
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 25 Aug 2010 18:46:47 +0800
parents dd1f3382d6a4
children ed59e659a202
comparison
equal deleted inserted replaced
747:d2f2ed27b84d 748:56a5e08cd8af
42 paint.fill(rect); 42 paint.fill(rect);
43 root.add_shape(rect); 43 root.add_shape(rect);
44 44
45 /* test removing a coord */ 45 /* test removing a coord */
46 var rm_coord = mb_rt.coord_new(root); 46 var rm_coord = mb_rt.coord_new(root);
47 var rm_rect = mb_rt.rect_new(150, 150, 50, 50, 10, 10); 47 var rm_rect1 = mb_rt.rect_new(150, 150, 50, 50, 10, 10);
48 paint.fill(rm_rect); 48 paint.fill(rm_rect1);
49 rm_coord.add_shape(rm_rect); 49 rm_coord.add_shape(rm_rect1);
50 var rm_rect2 = mb_rt.rect_new(100, 150, 50, 50, 10, 10);
51 paint.fill(rm_rect2);
52 rm_coord.add_shape(rm_rect2);
50 setTimeout(function() { 53 setTimeout(function() {
51 rm_coord.remove(); 54 rm_coord.remove();
52 mb_rt.redraw_changed(); 55 mb_rt.redraw_changed();
53 mb_rt.flush(); 56 mb_rt.flush();
54 }, 3000); 57 }, 3000);
58
59 /* test removing a shape */
60 setTimeout(function() {
61 rm_rect1.remove();
62 mb_rt.redraw_changed();
63 mb_rt.flush();
64 }, 2000);
55 65
56 /* Moving a path */ 66 /* Moving a path */
57 sys.puts(mb_rt.path_new); 67 sys.puts(mb_rt.path_new);
58 var path = mb_rt.path_new("m 100,50 L 120,50 L 200,150 L 180,150 z"); 68 var path = mb_rt.path_new("m 100,50 L 120,50 L 200,150 L 180,150 z");
59 sys.puts(path); 69 sys.puts(path);