Fixed mapping of animation speed values in the UI (how was that bug not found yet?)

This commit is contained in:
IceStormNG
2023-09-02 00:53:33 +02:00
parent e7eb7fab8a
commit 5dd3760e90

View File

@@ -301,8 +301,10 @@ namespace GHelper
private void ComboBoxAnimationSpeed_DropDownClosed(object? sender, EventArgs e) private void ComboBoxAnimationSpeed_DropDownClosed(object? sender, EventArgs e)
{ {
LightingSetting? ls = mouse.LightingSettingForZone(visibleZone); LightingSetting? ls = mouse.LightingSettingForZone(visibleZone);
ls.AnimationSpeed = (AnimationSpeed)comboBoxAnimationSpeed.SelectedIndex; // 0 => 0x9
// 1 => 0x7
// 2 => 0x5
ls.AnimationSpeed = (AnimationSpeed)(0x9 - (comboBoxAnimationSpeed.SelectedIndex * 0x2));
UpdateLightingSettings(ls, visibleZone); UpdateLightingSettings(ls, visibleZone);
} }
@@ -830,8 +832,10 @@ namespace GHelper
else else
pictureBoxLightingColor.BackColor = ls.RGBColor; pictureBoxLightingColor.BackColor = ls.RGBColor;
//0x09 => 0
comboBoxAnimationSpeed.SelectedIndex = (((int)ls.AnimationSpeed) - 5) / 2; //0x07 => 1
//0x05 => 2
comboBoxAnimationSpeed.SelectedIndex = 2 - ((((int)ls.AnimationSpeed) - 5) / 2);
comboBoxAnimationDirection.SelectedIndex = (int)ls.AnimationDirection; comboBoxAnimationDirection.SelectedIndex = (int)ls.AnimationDirection;
} }