|
@@ -413,9 +413,8 @@ void OptionsTab::CPlayerOptionTooltipBox::genBonusWindow()
|
|
|
}
|
|
|
|
|
|
OptionsTab::SelectedBox::SelectedBox(Point position, PlayerSettings & settings, SelType type)
|
|
|
- : CIntObject(RCLICK | WHEEL | GESTURE_PANNING, position)
|
|
|
+ : Scrollable(RCLICK, position, Orientation::HORIZONTAL)
|
|
|
, CPlayerSettingsHelper(settings, type)
|
|
|
- , panningDistanceAccumulated(0)
|
|
|
{
|
|
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
|
|
|
|
@@ -423,6 +422,8 @@ OptionsTab::SelectedBox::SelectedBox(Point position, PlayerSettings & settings,
|
|
|
subtitle = std::make_shared<CLabel>(23, 39, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, getName());
|
|
|
|
|
|
pos = image->pos;
|
|
|
+
|
|
|
+ setPanningStep(pos.w);
|
|
|
}
|
|
|
|
|
|
void OptionsTab::SelectedBox::update()
|
|
@@ -445,8 +446,11 @@ void OptionsTab::SelectedBox::clickRight(tribool down, bool previousState)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void OptionsTab::SelectedBox::wheelScrolled(int distance)
|
|
|
+void OptionsTab::SelectedBox::scrollBy(int distance)
|
|
|
{
|
|
|
+ // FIXME: currently options tab is completely recreacted from scratch whenever we receive any information from server
|
|
|
+ // because of that, panning event gets interrupted (due to destruction of element)
|
|
|
+ // so, currently, gesture will always move selection only by 1, and then wait for recreation from server info
|
|
|
distance = std::clamp(distance, -1, 1);
|
|
|
|
|
|
switch(CPlayerSettingsHelper::type)
|
|
@@ -461,38 +465,8 @@ void OptionsTab::SelectedBox::wheelScrolled(int distance)
|
|
|
CSH->setPlayerOption(LobbyChangePlayerOption::BONUS, distance, settings.color);
|
|
|
break;
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-void OptionsTab::SelectedBox::panning(bool on)
|
|
|
-{
|
|
|
- panningDistanceAccumulated = 0;
|
|
|
-}
|
|
|
-
|
|
|
-void OptionsTab::SelectedBox::gesturePanning(const Point & distanceDelta)
|
|
|
-{
|
|
|
- // FIXME: currently options tab is completely recreacted from scratch whenever we receive any information from server
|
|
|
- // because of that, panning event gets interrupted (due to destruction of element)
|
|
|
- // so, currently, gesture will always move selection only by 1, and then wait for recreation from server info
|
|
|
-
|
|
|
- int panningDistanceSingle = 48;
|
|
|
-
|
|
|
- panningDistanceAccumulated += distanceDelta.x;
|
|
|
-
|
|
|
- if (-panningDistanceAccumulated > panningDistanceSingle )
|
|
|
- {
|
|
|
- int scrollAmount = (-panningDistanceAccumulated) / panningDistanceSingle;
|
|
|
- wheelScrolled(-scrollAmount);
|
|
|
- panningDistanceAccumulated += scrollAmount * panningDistanceSingle;
|
|
|
- removeUsedEvents(GESTURE_PANNING);
|
|
|
- }
|
|
|
|
|
|
- if (panningDistanceAccumulated > panningDistanceSingle )
|
|
|
- {
|
|
|
- int scrollAmount = panningDistanceAccumulated / panningDistanceSingle;
|
|
|
- wheelScrolled(scrollAmount);
|
|
|
- panningDistanceAccumulated += -scrollAmount * panningDistanceSingle;
|
|
|
- removeUsedEvents(GESTURE_PANNING);
|
|
|
- }
|
|
|
+ setScrollingEnabled(false);
|
|
|
}
|
|
|
|
|
|
OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry(const PlayerSettings & S, const OptionsTab & parent)
|