Skip to content

Commit e94c40c

Browse files
committed
Fix - correct colors for lego1 and lego3 options
1 parent 3c32952 commit e94c40c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

scripts/JSRoot3DPainter.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,8 +1378,8 @@
13781378
var i1 = handle.i1, i2 = handle.i2, j1 = handle.j1, j2 = handle.j2,
13791379
i, j, x1, x2, y1, y2, binz, reduced, nobottom, notop,
13801380
main = this.main_painter(),
1381-
split_faces = ((this.options.Lego === 11) || (this.options.Lego === 13)) && (this.GetObject().fFillColor<2); // split each layer on two parts
1382-
1381+
histo = this.GetObject(),
1382+
split_faces = (this.options.Lego === 11) || (this.options.Lego === 13); // split each layer on two parts
13831383

13841384
if ((i1 >= i2) || (j1 >= j2)) return;
13851385

@@ -1511,7 +1511,7 @@
15111511
geometry.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
15121512
// geometry.computeVertexNormals();
15131513

1514-
var rootcolor = this.GetObject().fFillColor,
1514+
var rootcolor = histo.fFillColor,
15151515
fcolor = JSROOT.Painter.root_colors[rootcolor];
15161516

15171517
if (palette) {
@@ -1570,7 +1570,11 @@
15701570
//geom2.computeVertexNormals();
15711571

15721572
//var material2 = new THREE.MeshLambertMaterial( { color: 0xFF0000 } );
1573-
var material2 = new THREE.MeshBasicMaterial( { color: 0xFF0000, shading: THREE.SmoothShading } );
1573+
1574+
var color2 = (rootcolor<2) ? new THREE.Color(0xFF0000) :
1575+
new THREE.Color(d3.rgb(fcolor).darker(0.5).toString());
1576+
1577+
var material2 = new THREE.MeshBasicMaterial( { color: color2, shading: THREE.SmoothShading } );
15741578

15751579
var mesh2 = new THREE.Mesh(geom2, material2);
15761580
mesh2.bins_index = indx2;
@@ -1674,10 +1678,10 @@
16741678
if (uselineindx)
16751679
geometry.setIndex(new THREE.BufferAttribute(lindicies, 1));
16761680

1677-
var lcolor = JSROOT.Painter.root_colors[this.GetObject().fLineColor];
1681+
var lcolor = JSROOT.Painter.root_colors[histo.fLineColor];
16781682

16791683
material = new THREE.LineBasicMaterial({ color: new THREE.Color(lcolor) });
1680-
if (!JSROOT.browser.isIE) material.linewidth = this.GetObject().fLineWidth;
1684+
if (!JSROOT.browser.isIE) material.linewidth = histo.fLineWidth;
16811685
var line = new THREE.LineSegments(geometry, material);
16821686

16831687
/*
@@ -1976,7 +1980,6 @@
19761980
geometry.computeVertexNormals();
19771981
if (donormals && (lvl===1)) RecalculateNormals(geometry.getAttribute('normal').array);
19781982

1979-
19801983
var fcolor, material;
19811984
if (docolorfaces) {
19821985
fcolor = this.getIndexColor(lvl);

0 commit comments

Comments
 (0)