UI: Make vertical scrollbars directly draggable.

This commit is contained in:
Henrik Rydgård
2023-01-11 10:36:00 +01:00
parent 725f9ad78f
commit 69ff11fb40
2 changed files with 87 additions and 17 deletions
+18
View File
@@ -47,8 +47,22 @@ public:
NeighborResult FindScrollNeighbor(View *view, const Point &target, FocusDirection direction, NeighborResult best) override;
private:
float HardClampedScrollPos(float pos) const;
// TODO: Don't adjust pull_ within this!
float ClampedScrollPos(float pos);
// The "bob" is the draggable thingy on a scroll bar. Don't know a better name for it.
struct Bob {
bool show;
float thickness;
float size;
float offset;
float scrollMax;
};
Bob ComputeBob() const;
GestureDetector gesture_;
Orientation orientation_;
float scrollPos_ = 0.0f;
@@ -62,6 +76,10 @@ private:
float lastViewSize_ = 0.0f;
float *rememberPos_ = nullptr;
bool alignOpposite_ = false;
bool draggingBob_ = false;
float barDragStart_ = 0.0f;
float barDragOffset_ = 0.0f;
static float lastScrollPosX;
static float lastScrollPosY;