JSRootIO v3.0 stuck in infinite loop

Suppose you’re making a tabbed UI where the tab to display the JSRootUI isn’t the active tab initially. A typical way to have this tab loaded & ready, but not visible, is using the CSS ‘display: none;’ style.

In JSRootPainter.js line 4944, there’s a loop that continues while a calculated value is greater than the width. Unfortunately here the element’s ‘display: none’ width is zero, and the loop will never end.

I’ll be looking into how to load the JSRootIO drawing when the tab is switched, and therefore ‘display’ is switched to ‘block’ giving the element a width. But in the meantime, is there a way to still draw the SVG for the ROOT object when display is ‘none’?

<!-- 'display: none;' is applied by the tabbing tool, in this case AngularJS UI-Boostrap -->
<div style="display: none;">
	<div id="histogram-view"></div>
</div>
new JSROOT.TFile('http://somewhere.com/canvas.root', function(file) {
    file.ReadObject('canvas', 1, function(obj) {
       JSROOT.draw('histogram-view', obj);
    });
});	

Hi,

Thanks for reporting the problem.
In fact, if width or height of the element is 0 there is no reason to perform drawing at all.
I will provide fix soon.

Regards,
Sergey

Hi,

Could you try version from: http://web-docs.gsi.de/~linev/js/3.1/
There is tar ball:http://web-docs.gsi.de/~linev/js/3.1/JsRoot31.tar.gz

If code works for you, it will be submitted in repository.

Regards,
Sergey