Refactor MomentumScroll to be more in line with other interface prefs
This commit is contained in:
parent
ba72dc7a22
commit
bdcf486a8d
@ -64,6 +64,7 @@ bool fullscreen = false;
|
|||||||
bool altFullscreen = false;
|
bool altFullscreen = false;
|
||||||
bool forceIntegerScaling = true;
|
bool forceIntegerScaling = true;
|
||||||
bool resizable = false;
|
bool resizable = false;
|
||||||
|
bool momentumScroll = true;
|
||||||
|
|
||||||
|
|
||||||
void ClipboardPush(ByteString text)
|
void ClipboardPush(ByteString text)
|
||||||
@ -696,6 +697,7 @@ int main(int argc, char * argv[])
|
|||||||
fullscreen = Client::Ref().GetPrefBool("Fullscreen", false);
|
fullscreen = Client::Ref().GetPrefBool("Fullscreen", false);
|
||||||
altFullscreen = Client::Ref().GetPrefBool("AltFullscreen", false);
|
altFullscreen = Client::Ref().GetPrefBool("AltFullscreen", false);
|
||||||
forceIntegerScaling = Client::Ref().GetPrefBool("ForceIntegerScaling", true);
|
forceIntegerScaling = Client::Ref().GetPrefBool("ForceIntegerScaling", true);
|
||||||
|
momentumScroll = Client::Ref().GetPrefBool("MomentumScroll", true);
|
||||||
|
|
||||||
|
|
||||||
if(arguments["kiosk"] == "true")
|
if(arguments["kiosk"] == "true")
|
||||||
@ -785,6 +787,7 @@ int main(int argc, char * argv[])
|
|||||||
ui::Engine::Ref().Fullscreen = fullscreen;
|
ui::Engine::Ref().Fullscreen = fullscreen;
|
||||||
ui::Engine::Ref().SetAltFullscreen(altFullscreen);
|
ui::Engine::Ref().SetAltFullscreen(altFullscreen);
|
||||||
ui::Engine::Ref().SetForceIntegerScaling(forceIntegerScaling);
|
ui::Engine::Ref().SetForceIntegerScaling(forceIntegerScaling);
|
||||||
|
ui::Engine::Ref().SetMomentumScroll(momentumScroll);
|
||||||
|
|
||||||
engine = &ui::Engine::Ref();
|
engine = &ui::Engine::Ref();
|
||||||
engine->SetMaxSize(desktopWidth, desktopHeight);
|
engine->SetMaxSize(desktopWidth, desktopHeight);
|
||||||
|
@ -34,7 +34,8 @@ Engine::Engine():
|
|||||||
mousexp_(0),
|
mousexp_(0),
|
||||||
mouseyp_(0),
|
mouseyp_(0),
|
||||||
maxWidth(0),
|
maxWidth(0),
|
||||||
maxHeight(0)
|
maxHeight(0),
|
||||||
|
momentumScroll(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +119,19 @@ namespace ui
|
|||||||
|
|
||||||
int maxWidth;
|
int maxWidth;
|
||||||
int maxHeight;
|
int maxHeight;
|
||||||
|
|
||||||
|
bool momentumScroll;
|
||||||
|
|
||||||
|
public:
|
||||||
|
inline void SetMomentumScroll(bool newMomentumScroll)
|
||||||
|
{
|
||||||
|
momentumScroll = newMomentumScroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool GetMomentumScroll() const
|
||||||
|
{
|
||||||
|
return momentumScroll;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "ScrollPanel.h"
|
#include "ScrollPanel.h"
|
||||||
|
#include "Engine.h"
|
||||||
|
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
@ -21,10 +22,8 @@ ScrollPanel::ScrollPanel(Point position, Point size):
|
|||||||
scrollbarSelected(false),
|
scrollbarSelected(false),
|
||||||
scrollbarInitialYOffset(0),
|
scrollbarInitialYOffset(0),
|
||||||
scrollbarInitialYClick(0),
|
scrollbarInitialYClick(0),
|
||||||
scrollbarClickLocation(0),
|
scrollbarClickLocation(0)
|
||||||
momentumScroll(false)
|
|
||||||
{
|
{
|
||||||
momentumScroll = Client::Ref().GetPrefBool("MomentumScroll", true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScrollPanel::GetScrollLimit()
|
int ScrollPanel::GetScrollLimit()
|
||||||
@ -46,7 +45,7 @@ void ScrollPanel::XOnMouseWheelInside(int localx, int localy, int d)
|
|||||||
{
|
{
|
||||||
if (!d)
|
if (!d)
|
||||||
return;
|
return;
|
||||||
if (momentumScroll)
|
if (ui::Engine::Ref().GetMomentumScroll())
|
||||||
yScrollVel -= d * 2;
|
yScrollVel -= d * 2;
|
||||||
else
|
else
|
||||||
yScrollVel -= d * 20;
|
yScrollVel -= d * 20;
|
||||||
@ -144,7 +143,7 @@ void ScrollPanel::XTick(float dt)
|
|||||||
offsetX += xScrollVel;
|
offsetX += xScrollVel;
|
||||||
|
|
||||||
|
|
||||||
if (momentumScroll)
|
if (ui::Engine::Ref().GetMomentumScroll())
|
||||||
{
|
{
|
||||||
if (yScrollVel > -0.5f && yScrollVel < 0.5)
|
if (yScrollVel > -0.5f && yScrollVel < 0.5)
|
||||||
yScrollVel = 0;
|
yScrollVel = 0;
|
||||||
|
@ -16,7 +16,6 @@ namespace ui
|
|||||||
bool isMouseInsideScrollbar;
|
bool isMouseInsideScrollbar;
|
||||||
bool isMouseInsideScrollbarArea;
|
bool isMouseInsideScrollbarArea;
|
||||||
bool scrollbarSelected;
|
bool scrollbarSelected;
|
||||||
bool momentumScroll;
|
|
||||||
int scrollbarInitialYOffset;
|
int scrollbarInitialYOffset;
|
||||||
int scrollbarInitialYClick;
|
int scrollbarInitialYClick;
|
||||||
int scrollbarClickLocation;
|
int scrollbarClickLocation;
|
||||||
|
@ -234,6 +234,7 @@ bool OptionsModel::GetMomentumScroll()
|
|||||||
void OptionsModel::SetMomentumScroll(bool state)
|
void OptionsModel::SetMomentumScroll(bool state)
|
||||||
{
|
{
|
||||||
Client::Ref().SetPref("MomentumScroll", state);
|
Client::Ref().SetPref("MomentumScroll", state);
|
||||||
|
ui::Engine::Ref().SetMomentumScroll(state);
|
||||||
notifySettingsChanged();
|
notifySettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user