Jun 13, 2012, 8:46 AM
[CLOSED] Event for when drawing is finished
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:
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>
Last edited by Daniil; Jun 20, 2012 at 10:59 AM.
Reason: [CLOSED]