Skip to content

Commit 600181a

Browse files
author
Pavel Kovalenko
committed
Add AlphaEnabled property for ColorPicker control.
1 parent d0c105f commit 600181a

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/editors/xrSdkControls/Controls/ColorPicker/ColorPicker.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public sealed partial class ColorPicker : UserControl
1212
private Color color;
1313
private bool hexadecimal;
1414
private bool ignoreOnChanged = false;
15+
private bool alphaEnabled = true;
1516

1617
public ColorPicker()
1718
{
@@ -29,7 +30,8 @@ public Color Value
2930
return;
3031
color = value;
3132
ignoreOnChanged = true;
32-
nslAlpha.Value = color.A;
33+
if (alphaEnabled)
34+
nslAlpha.Value = color.A;
3335
nslRed.Value = color.R;
3436
nslGreen.Value = color.G;
3537
nslBlue.Value = color.B;
@@ -43,6 +45,23 @@ public Color Value
4345
public byte Blue { get; private set; }
4446
public byte Alpha { get; private set; }
4547

48+
public bool AlphaEnabled
49+
{
50+
get { return alphaEnabled; }
51+
set
52+
{
53+
if (alphaEnabled == value)
54+
return;
55+
alphaEnabled = value;
56+
ignoreOnChanged = true;
57+
nslAlpha.Value = nslAlpha.Maximum;
58+
ignoreOnChanged = false;
59+
UpdateColor();
60+
lAlpha.Enabled = alphaEnabled;
61+
nslAlpha.Enabled = alphaEnabled;
62+
}
63+
}
64+
4665
public bool Hexadecimal
4766
{
4867
get { return hexadecimal; }

0 commit comments

Comments
 (0)