Skip to content

Commit

Permalink
Menu: Fix mouse handling for the autoaim slider.
Browse files Browse the repository at this point in the history
  • Loading branch information
svdijk authored and coelckers committed May 16, 2017
1 parent a92f889 commit ebf3a37
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions wadsrc/static/zscript/menu/playercontrols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ class ListMenuItemSlider : ListMenuItemSelectable
int mMinrange, mMaxrange;
int mStep;
int mSelection;
int mDrawX;

//=============================================================================
//
Expand All @@ -380,6 +381,7 @@ class ListMenuItemSlider : ListMenuItemSelectable
mMinrange = min;
mMaxrange = max;
mStep = step;
mDrawX = 0;
}

//=============================================================================
Expand All @@ -398,6 +400,7 @@ class ListMenuItemSlider : ListMenuItemSelectable
mMinrange = min;
mMaxrange = max;
mStep = step;
mDrawX = 0;
}

//=============================================================================
Expand Down Expand Up @@ -466,8 +469,8 @@ class ListMenuItemSlider : ListMenuItemSelectable
lm.ReleaseFocus();
}

int slide_left = SmallFont.StringWidth ("Green") + 8 + int(mXpos);
int slide_right = slide_left + 12*8; // 12 char cells with 8 pixels each.
int slide_left = mDrawX + 8;
int slide_right = slide_left + 10*8; // 12 char cells with 8 pixels each.

if (type == Menu.MOUSE_Click)
{
Expand Down Expand Up @@ -520,6 +523,8 @@ class ListMenuItemSlider : ListMenuItemSelectable

double x = SmallFont.StringWidth ("Green") + 8 + mXpos;
double x2 = SmallFont.StringWidth (text) + 8 + mXpos;
DrawSlider (MAX(x2, x), mYpos);
mDrawX = MAX(x2, x);

DrawSlider (mDrawX, mYpos);
}
}

0 comments on commit ebf3a37

Please sign in to comment.