Skip to content

Commit

Permalink
fix(RodEditor): Add color to rod preview
Browse files Browse the repository at this point in the history
  • Loading branch information
floryst committed May 1, 2018
1 parent 912b1f0 commit 29d3737
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/simput/RodEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,18 @@ export default class RodEditor extends React.Component {

let items = [];
if (this.props.data.value && this.props.data.value.length) {
items = this.props.data.value[0].stack.map((layer, idx) =>
Object.assign({ key: idx }, layer)
);
items = this.props.data.value[0].stack.map((layer, idx) => {
const color = this.props.ui.domain.cells[layer.label].color;
// adds alpha channel
const background = ColorManager.toRGBA(color.concat([1]));
return Object.assign(
{
key: idx,
color: background,
},
layer
);
});
}

const totalLength = Number(this.props.viewData.rodInfo.height.value[0]);
Expand Down

0 comments on commit 29d3737

Please sign in to comment.