1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fixed 1277 - only 2 cursor buttons will be enabled for sliders, depending on its direction (horizontal/vertical)

This commit is contained in:
Ivan Savenko 2014-09-18 17:08:21 +03:00
parent a17e27bfc6
commit 3939c70a81

View File

@ -706,16 +706,24 @@ void CSlider::keyPressed(const SDL_KeyboardEvent & key)
{ {
if(key.state != SDL_PRESSED) return; if(key.state != SDL_PRESSED) return;
int moveDest = 0; int moveDest = value;
switch(key.keysym.sym) switch(key.keysym.sym)
{ {
case SDLK_UP: case SDLK_UP:
if (!horizontal)
moveDest = value - scrollStep;
break;
case SDLK_LEFT: case SDLK_LEFT:
moveDest = value - scrollStep; if (horizontal)
moveDest = value - scrollStep;
break; break;
case SDLK_DOWN: case SDLK_DOWN:
if (!horizontal)
moveDest = value + scrollStep;
break;
case SDLK_RIGHT: case SDLK_RIGHT:
moveDest = value + scrollStep; if (horizontal)
moveDest = value + scrollStep;
break; break;
case SDLK_PAGEUP: case SDLK_PAGEUP:
moveDest = value - capacity + scrollStep; moveDest = value - capacity + scrollStep;