MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ColorPickerDialog

Class ColorPickerDialog

Source/Editor/GUI/Dialogs/ColorPickerDialog.cs:27–657  ·  view source on GitHub ↗

Color picking dialog.

Source from the content-addressed store, hash-verified

25 /// </summary>
26 /// <seealso cref="FlaxEditor.GUI.Dialogs.Dialog" />
27 public class ColorPickerDialog : Dialog, IColorPickerDialog
28 {
29 private const float PickerMargin = 6.0f;
30 private const float ChannelsMargin = 4.0f;
31 private const float ChannelTextWidth = 12.0f;
32 private const float SavedColorButtonWidth = 20.0f;
33 private const float SavedColorButtonHeight = 20.0f;
34 private const float TabHeight = 20;
35 private const float ValueBoxesWidth = 100.0f;
36 private const float HSVRGBTextWidth = 15.0f;
37 private const float ColorPreviewHeight = 50.0f;
38 private const int SavedColorsAmount = 10;
39
40 private Color _initialValue;
41 private Color _value;
42 private bool _disableEvents;
43 private bool _useDynamicEditing;
44 private bool _activeEyedropper;
45 private bool _canPassLastChangeEvent = true;
46 private bool _linear;
47 private ColorValueBox.ColorPickerEvent _onChanged;
48 private ColorValueBox.ColorPickerClosedEvent _onClosed;
49
50 private ColorSelectorWithSliders _cSelector;
51 private Tabs.Tabs _hsvRGBTabs;
52 private Tab _RGBTab;
53 private Panel _rgbPanel;
54 private FloatValueBox _cRed;
55 private FloatValueBox _cGreen;
56 private FloatValueBox _cBlue;
57 private Tab _hsvTab;
58 private Panel _hsvPanel;
59 private FloatValueBox _cHue;
60 private FloatValueBox _cSaturation;
61 private FloatValueBox _cValue;
62 private TextBox _cHex;
63 private FloatValueBox _cAlpha;
64 private Button _cEyedropper;
65 private Button _cLinearSRGB;
66
67 private List<Color> _savedColors = new List<Color>();
68 private List<Button> _savedColorButtons = new List<Button>();
69
70 /// <summary>
71 /// Gets the selected color.
72 /// </summary>
73 public Color SelectedColor
74 {
75 get => _value;
76 private set
77 {
78 if (_disableEvents || value == _value)
79 return;
80
81 _disableEvents = true;
82 _value = value;
83 var clamped = Color.Min(Color.White, value);
84

Callers

nothing calls this directly

Calls 3

MinMethod · 0.45
ToHSVMethod · 0.45
ToHexStringMethod · 0.45

Tested by

no test coverage detected