Skip to content

Commit 2a3e94d

Browse files
committed
Update drawoptions.htm demo, fix 'toggle col' menu error
git-svn-id: https://subversion.gsi.de/dabc/trunk/plugins/root/js@2818 bcbf6573-9a26-0410-9ebc-ce4ab7aade96
1 parent 0b60330 commit 2a3e94d

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

demo/drawoptions.htm

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,22 @@
3232
function draw_item_options(file, itemname, divid, options, factor) {
3333
var arr = options.split(";");
3434

35+
var fname = (file.fURL.indexOf("http://")==0) ? fname : "demo/"+ file.fURL;
36+
3537
var has_equal = false;
36-
var html = "Supported options: ";
38+
39+
var html = 'File: <a href="../index.htm?file=' + fname + '" target="_blank">' + fname.slice(fname.lastIndexOf('/')+1) + '</a>';
3740
for (var i in arr) {
38-
if (i>0) html += ", ";
39-
html += '<a href="../index.htm?nobrowser&file=';
40-
if (file.fURL.indexOf("http://")==0) html += file.fURL;
41-
else html += "demo/"+ file.fURL;
41+
if (i==0) html += " Item: "; else
42+
if (i==1) html += " Options: "; else html += ", ";
43+
html += '<a href="../index.htm?nobrowser&file=' + fname;
4244
html += '&item=' + itemname + '&';
4345

4446
if (arr[i].indexOf("=")<0) html += 'opt=' + arr[i];
4547
else { html += arr[i]; has_equal = true; }
4648

4749
html += '" target="_blank">';
50+
if (i==0) html += itemname; else
4851
if (arr[i] == "") html += '&lt;default&gt;'; else html += arr[i];
4952
html += '</a>';
5053
}
@@ -63,7 +66,7 @@
6366
if (factor!=null) h = w * factor;
6467

6568
for (var i in arr) {
66-
var subid = divid + "_" + arr[i];
69+
var subid = divid + "_" + i;
6770

6871
var html = '<div id="' + subid + '" style="width:'+w+'px; height:'+h+'px"></div>';
6972
$("#" + divid).append(html);
@@ -159,13 +162,11 @@
159162
LoadFile("can4.root", function(file) {
160163
draw_item_options(file, "c1;1", "can8_draw", "", 0.);
161164
});
165+
LoadFile("higgs_c.root", function(file) {
166+
draw_item_options(file, "c;1", "can9_draw", "col=1;col=2;col=3", 0.);
167+
});
162168
}
163169

164-
LoadFile("higgs_c.root", function(file) {
165-
draw_item_options(file, "c;1", "can9_draw", "col=1;col=2;col=3", 0.);
166-
});
167-
168-
169170

170171
// JSROOT.RegisterForResize(function() { if (objpainter) objpainter.CheckResize(); });
171172
}

scripts/JSRootPainter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5170,7 +5170,10 @@
51705170
JSROOT.Painter.menuitem(menu, "Auto zoom-in", function() { menu['painter'].AutoZoom(); });
51715171
JSROOT.Painter.menuitem(menu, "Draw in 3D", function() { menu['painter'].Draw3D(); });
51725172
JSROOT.Painter.menuitem(menu, "Toggle col", function() {
5173-
menu['painter'].options.Color = -1 * menu['painter'].options.Color;
5173+
if (menu['painter'].options.Color == 0)
5174+
menu['painter'].options.Color = JSROOT.gStyle.DefaultCol;
5175+
else
5176+
menu['painter'].options.Color = -1 * menu['painter'].options.Color;
51745177
menu['painter'].RedrawPad();
51755178
});
51765179

0 commit comments

Comments
 (0)