mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- fixed mouse input for scale slider.
This commit is contained in:
parent
228c57fae3
commit
51d89740e3
1 changed files with 22 additions and 4 deletions
|
@ -1222,6 +1222,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider
|
|||
{
|
||||
String TextZero;
|
||||
String TextNegOne;
|
||||
int mClickVal;
|
||||
|
||||
OptionMenuItemScaleSlider Init(String label, Name command, double min, double max, double step, String zero, String negone = "")
|
||||
{
|
||||
|
@ -1229,6 +1230,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider
|
|||
mCVar =CVar.FindCVar(command);
|
||||
TextZero = zero;
|
||||
TextNEgOne = negone;
|
||||
mClickVal = -10;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -1238,7 +1240,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider
|
|||
drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor);
|
||||
|
||||
int Selection = GetSliderValue();
|
||||
if (Selection == 0 || Selection == -1)
|
||||
if ((Selection == 0 || Selection == -1) && mClickVal <= 0)
|
||||
{
|
||||
String text = Selection == 0? TextZero : Selection == -1? TextNegOne : "";
|
||||
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true);
|
||||
|
@ -1254,10 +1256,26 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider
|
|||
override bool MouseEvent(int type, int x, int y)
|
||||
{
|
||||
int value = GetSliderValue();
|
||||
if (value > 0) return Super.MouseEvent(type, x, y);
|
||||
if (type == Menu.MOUSE_Release)
|
||||
switch (type)
|
||||
{
|
||||
return Menu.GetCurrentMenu().MenuEvent(Menu.MKEY_Enter, true);
|
||||
case Menu.MOUSE_Click:
|
||||
mClickVal = value;
|
||||
if (value <= 0) return false;
|
||||
return Super.MouseEvent(type, x, y);
|
||||
|
||||
case Menu.MOUSE_Move:
|
||||
if (mClickVal <= 0) return false;
|
||||
return Super.MouseEvent(type, x, y);
|
||||
|
||||
case Menu.MOUSE_Release:
|
||||
if (mClickVal <= 0)
|
||||
{
|
||||
mClickVal = -10;
|
||||
SetSliderValue(value + 1);
|
||||
return true;
|
||||
}
|
||||
mClickVal = -10;
|
||||
return Super.MouseEvent(type, x, y);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue