PDA

View Full Version : [CLOSED] Event for when drawing is finished



Stijn
Jun 13, 2012, 8:46 AM
Is there an event I can subscribe to for when all drawing has finished?
Right now I bind to Ext.onReady and also use setTimeout, to be sure all elements have been positioned. This is to add some custom shapes to the SVG object, I need to know the coordinates of some elements drawn by Ext.NET

My (testing) code:


<script type="text/javascript">
Ext.onReady(function ()
{
window.setTimeout(function ()
{
var svg = document.getElementsByTagName("svg")[0];
var bottom_axis = svg.getElementsByTagName("path")[0];
var top_axis = svg.getElementsByTagName("path")[1];

var bottom_left = bottom_axis.pathSegList.getItem(2);
var bottom_right = bottom_axis.pathSegList.getItem(4);
var top_left = top_axis.pathSegList.getItem(2);
var top_right = top_axis.pathSegList.getItem(4);

console.log(bottom_left);
console.log(bottom_right);
console.log(top_left);
console.log(top_right);

var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
rect.setAttribute("fill", "red");
rect.setAttribute("fill-opacity", "0.25");
rect.setAttribute("x", top_left.x);
rect.setAttribute("y", top_left.y);
rect.setAttribute("width", top_right.x - top_left.x);
rect.setAttribute("height", bottom_left.y - top_left.y);
svg.appendChild(rect);
}, 2000);
});
</script>

Daniil
Jun 13, 2012, 1:15 PM
Hi,


Is there an event I can subscribe to for when all drawing has finished?

Do you mean charts or the whole page?

Generally, there is no such event. Unfortunately, browsers doesn't provide such event in its API.

For charts we can suggest to try the buffered AfterAnimate listener:
http://forums.ext.net/showthread.php?19184&p=82684&viewfull=1#post82684