https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113139
Revision: 113139
Author: nad
Date: 2012-03-06 14:31:26 +0000 (Tue, 06 Mar 2012)
Log Message:
-----------
position root element based on total width and height, not relative to parent
Modified Paths:
--------------
trunk/extensions/TreeAndMenu/star.js
Modified: trunk/extensions/TreeAndMenu/star.js
===================================================================
--- trunk/extensions/TreeAndMenu/star.js 2012-03-06 14:27:40 UTC (rev
113138)
+++ trunk/extensions/TreeAndMenu/star.js 2012-03-06 14:31:26 UTC (rev
113139)
@@ -7,8 +7,8 @@
easing: 'swing',
out_spin: 2,
in_spin: 2,
- width: '500px',
- height: '500px'
+ width: 500,
+ height: 500
}
/**
@@ -59,13 +59,17 @@
p = p.children().first();
$('img', p).attr('src', window.tamBaseUrl +
window.star_config.img_node);
getData(p).children.push(e);
+
+ // Set initial position to parent
+ var ox = p.position().left + p.width() / 2;
+ var oy = p.position().top + p.height() / 2;
+ e.css('left', ox - e.width() / 2).css('top', oy
- e.height() / 2);
}
- // Set initial position to parent
- var ox = p.position().left + p.width() / 2;
- var oy = p.position().top + p.height() / 2;
- e.css('left', ox - e.width() / 2).css('top', oy -
e.height() / 2);
+ // If root, set position to half width/height
+ else e.css('left', window.star_config.width /
2).css('top', window.star_config.height / 2);
+
// Create a unique ID and persistent data for this
element
e.attr('id', 'starnode' + window.stars.length);
window.stars.push( {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs