Index: trunk/extensions/TreeAndMenu/star.js |
— | — | @@ -7,8 +7,8 @@ |
8 | 8 | easing: 'swing', |
9 | 9 | out_spin: 2, |
10 | 10 | in_spin: 2, |
11 | | - width: '500px', |
12 | | - height: '500px' |
| 11 | + width: 500, |
| 12 | + height: 500 |
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
— | — | @@ -59,13 +59,17 @@ |
60 | 60 | p = p.children().first(); |
61 | 61 | $('img', p).attr('src', window.tamBaseUrl + window.star_config.img_node); |
62 | 62 | getData(p).children.push(e); |
| 63 | + |
| 64 | + // Set initial position to parent |
| 65 | + var ox = p.position().left + p.width() / 2; |
| 66 | + var oy = p.position().top + p.height() / 2; |
| 67 | + e.css('left', ox - e.width() / 2).css('top', oy - e.height() / 2); |
63 | 68 | } |
64 | 69 | |
65 | | - // Set initial position to parent |
66 | | - var ox = p.position().left + p.width() / 2; |
67 | | - var oy = p.position().top + p.height() / 2; |
68 | | - e.css('left', ox - e.width() / 2).css('top', oy - e.height() / 2); |
| 70 | + // If root, set position to half width/height |
| 71 | + else e.css('left', window.star_config.width / 2).css('top', window.star_config.height / 2); |
69 | 72 | |
| 73 | + |
70 | 74 | // Create a unique ID and persistent data for this element |
71 | 75 | e.attr('id', 'starnode' + window.stars.length); |
72 | 76 | window.stars.push( { |