1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Replaced clickLeft with clickPressed clickReleased methods

This commit is contained in:
Ivan Savenko
2023-07-08 14:33:04 +03:00
parent fa4a0004b2
commit ca889a5c2a
65 changed files with 372 additions and 420 deletions

View File

@@ -121,20 +121,20 @@ void CSlider::scrollTo(int to)
moved(to);
}
void CSlider::clickLeft(tribool down, bool previousState)
void CSlider::clickPressed(const Point & cursorPosition)
{
if(down && !slider->isBlocked())
if(!slider->isBlocked())
{
double pw = 0;
double rw = 0;
if(getOrientation() == Orientation::HORIZONTAL)
{
pw = GH.getCursorPosition().x-pos.x-25;
pw = cursorPosition.x-pos.x-25;
rw = pw / static_cast<double>(pos.w - 48);
}
else
{
pw = GH.getCursorPosition().y-pos.y-24;
pw = cursorPosition.y-pos.y-24;
rw = pw / (pos.h-48);
}
@@ -142,7 +142,7 @@ void CSlider::clickLeft(tribool down, bool previousState)
if (!vstd::iswithin(rw, 0, 1))
return;
slider->clickLeft(true, slider->isMouseLeftButtonPressed());
slider->clickPressed(cursorPosition);
scrollTo((int)(rw * positions + 0.5));
return;
}