From 2906e316348bbaf6b82ff5af229e58041d6615bf Mon Sep 17 00:00:00 2001 From: lisyarus Date: Thu, 5 Jan 2023 18:38:47 +0300 Subject: [PATCH] Fix scroller position after reshape --- libs/ui/source/scroller.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/ui/source/scroller.cpp b/libs/ui/source/scroller.cpp index 7b90a346..2dbd0db0 100644 --- a/libs/ui/source/scroller.cpp +++ b/libs/ui/source/scroller.cpp @@ -224,6 +224,15 @@ namespace psemek::ui child_bbox[0].max = child_bbox[0].min + child_constraints[0].min; } + { + auto old_shift = shift_tgt_; + clamp_shift(); + if (shift_tgt_[0] != old_shift[0]) + shift_[0] = shift_tgt_[0]; + if (shift_tgt_[1] != old_shift[1]) + shift_[1] = shift_tgt_[1]; + } + if (horizontal_scroll()) child_bbox[0] += shift_[0];