Refactoring some messy logic
I would be interested to know how some of you more experianced programers might refactor this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
if(control.enabled)
{
if(control.down)
{
themeManager.currentTheme.palette.highlightColor
}
else
{
if(control.flat)
{
"transparent"
}
else
{
if(control.isPrimary)
{
control.style.primaryColor
}
else
{
control.style.fillColor
}
}
}
}
else
{
"gray"
}
|
Last edited on
Just reformatting, no change in what you've done.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
if (control.enabled)
{
if (control.down)
{
// themeManager.currentTheme.palette.highlightColor
}
else if (control.flat)
{
// "transparent"
}
else if (control.isPrimary)
{
// control.style.primaryColor
}
else
{
// control.style.fillColor
}
}
else
{
// "gray"
}
|
Topic archived. No new replies allowed.