From 7d753ae2d82592e09e04e4ecf11df976a2d187fd Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Wed, 7 Jun 2023 18:42:50 +0200 Subject: Debug and improve focus and scrollbars code --- src/components/Scrollbar.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/components/Scrollbar.hpp') diff --git a/src/components/Scrollbar.hpp b/src/components/Scrollbar.hpp index c313c69..5caba75 100644 --- a/src/components/Scrollbar.hpp +++ b/src/components/Scrollbar.hpp @@ -8,13 +8,19 @@ class Scrollbar : public Component { bool IsHorizontal; Element bg,bar; double DragY,DragX; + double FocusX,FocusY; + /// @brief Should focus be applied on the next draw + bool ShouldApplyFocus; + /// @brief Use to detect scrollbar drags bool Trigger; - /// @brief Canvas size cache used to reset on resize - double CanvasWidth, CanvasHeight; + /// @brief Goto a given graphical coordinate (if possible using current scroll range) + void ApplyFocus(); public: Scrollbar(Status* s,bool IsHorizontal); void Refresh(); - /// @brief Goto a given graphical coordinate (if possible using current scroll range) + /// @brief Focus on a coordinate on the next draw void Focus(double XorY); + /// @brief Undo all scroll operations, go back to the origin + void Reset(); }; } // namespace cgeditor \ No newline at end of file -- cgit v1.2.3