Skip to content

Commit fc54e8c

Browse files
committed
- fixed wrong texture for ColorPicker (BrightnessSaturationPicker control);
- removed callbacks from NumericUpDown;
1 parent ca529fc commit fc54e8c

File tree

3 files changed

+16
-25
lines changed

3 files changed

+16
-25
lines changed

System/Windows/Forms/ColorPicker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ private void _UpdateImage()
456456

457457
for (int k = 0; k < _image.Height; k++)
458458
{
459-
luminosity = (float)k / _image.Height;
459+
luminosity = 1f - (float)k / _image.Height;
460460

461461
// HSL to RGB convertion.
462462
Color pixelColor = Color.FromHsb(hue, saturation, luminosity);

System/Windows/Forms/Form.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,13 @@ public void SetResize(ControlResizeTypes resize)
350350
break;
351351
}
352352
}
353-
public void Show(bool shouldFocus = true)
353+
public void Show(bool fShouldFocus = true)
354354
{
355355
Visible = true;
356356
int self = Owner.Forms.FindIndex(x => x == this);
357357
if (self == -1)
358358
Owner.Forms.Add(this);
359-
if (shouldFocus)
359+
if (fShouldFocus)
360360
{
361361
Focus();
362362
_SelectFirstControl();

System/Windows/Forms/NumericUpDown.cs

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,9 @@ public decimal Value
5555
_value = value;
5656
valueText = value.ToString();
5757
if (changed)
58-
{
5958
ValueChanged(this, null);
60-
if (ValueChangedCallback != null)
61-
ValueChangedCallback.Invoke(ValueChangedCallbackInfo);
62-
}
6359
}
6460
}
65-
public CallbackDelegate ValueChangedCallback { get; set; }
66-
public object ValueChangedCallbackInfo { get; set; }
6761

6862
public NumericUpDown() : this(true)
6963
{
@@ -114,27 +108,19 @@ public NumericUpDown(bool initButtons)
114108
Controls.Add(ButtonDecrease);
115109
}
116110

117-
Resize += _UpdateButtonsLocation;
118-
LostFocus += (s, a) => { _ConfirmValue(); };
111+
Resize += UpdateButtonsLocation;
112+
LostFocus += (s, a) => { ConfirmValue(); };
119113
}
120114

121-
private void _ConfirmValue()
115+
public event EventHandler ValueChanged = delegate { };
116+
117+
protected void ConfirmValue()
122118
{
123119
decimal value = Value;
124120
if (decimal.TryParse(valueText, out value))
125121
if (Value != value)
126122
Value = value;
127123
}
128-
private void _UpdateButtonsLocation(object sender, EventArgs e)
129-
{
130-
if (ButtonIncrease != null)
131-
ButtonIncrease.Location = new Point(Width - 16, Height / 2 - 8);
132-
if (ButtonDecrease != null)
133-
ButtonDecrease.Location = new Point(Width - 16, Height / 2);
134-
}
135-
136-
public event EventHandler ValueChanged = delegate { };
137-
138124
public void HideButtons()
139125
{
140126
ButtonIncrease.Visible = false;
@@ -151,7 +137,7 @@ protected override void OnKeyPress(KeyEventArgs e)
151137
base.OnKeyPress(e);
152138

153139
if (e.KeyCode == UnityEngine.KeyCode.Return)
154-
_ConfirmValue();
140+
ConfirmValue();
155141
}
156142
protected override void OnMouseWheel(MouseEventArgs e)
157143
{
@@ -187,7 +173,12 @@ public void ShowButtons()
187173
ButtonIncrease.Visible = true;
188174
ButtonDecrease.Visible = true;
189175
}
190-
191-
public delegate void CallbackDelegate(object data);
176+
protected void UpdateButtonsLocation(object sender, EventArgs e)
177+
{
178+
if (ButtonIncrease != null)
179+
ButtonIncrease.Location = new Point(Width - 16, Height / 2 - 8);
180+
if (ButtonDecrease != null)
181+
ButtonDecrease.Location = new Point(Width - 16, Height / 2);
182+
}
192183
}
193184
}

0 commit comments

Comments
 (0)