Skip to content

Commit 099cd27

Browse files
committed
Fix problem with draw options list
When draw handle registered only for icon (not for drawing), do not return opts list. Use non-empty opts list to detect if object can be drawn
1 parent 5694156 commit 099cd27

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

scripts/JSRootPainter.jquery.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,15 +491,17 @@
491491
if (fileprop != null) {
492492
var opts = JSROOT.getDrawOptions(hitem._kind, 'nosame');
493493

494-
menu.addDrawMenu("Draw", opts, function(arg) { painter.display(itemname, arg); });
494+
if (opts!=null)
495+
menu.addDrawMenu("Draw", opts, function(arg) { painter.display(itemname, arg); });
495496

496497
var filepath = qualifyURL(fileprop.fileurl);
497498
if (filepath.indexOf(JSROOT.source_dir) == 0)
498499
filepath = filepath.slice(JSROOT.source_dir.length);
499500

500-
menu.addDrawMenu("Draw in new window", opts, function(arg) {
501-
window.open(JSROOT.source_dir + "index.htm?nobrowser&file=" + filepath + "&item=" + fileprop.itemname+"&opt="+arg);
502-
});
501+
if (opts!=null)
502+
menu.addDrawMenu("Draw in new window", opts, function(arg) {
503+
window.open(JSROOT.source_dir + "index.htm?nobrowser&file=" + filepath + "&item=" + fileprop.itemname+"&opt="+arg);
504+
});
503505
}
504506

505507
if (menu.size()>0) {

scripts/JSRootPainter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9693,7 +9693,7 @@
96939693
var allopts = null, isany = false;
96949694
for (var cnt=0;cnt<1000;cnt++) {
96959695
var h = JSROOT.getDrawHandle(kind, cnt);
9696-
if (h==null) break;
9696+
if ((h==null) || !('func' in h)) break;
96979697
isany = true;
96989698
if (! ('opt' in h)) continue;
96999699
var opts = h.opt.split(';');
@@ -9715,7 +9715,7 @@
97159715
}
97169716

97179717
JSROOT.canDraw = function(classname) {
9718-
return JSROOT.getDrawHandle("ROOT." + classname) != null;
9718+
return JSROOT.getDrawOptions("ROOT." + classname) != null;
97199719
}
97209720

97219721
/** @fn JSROOT.draw(divid, obj, opt)

0 commit comments

Comments
 (0)