From cabf16635a3498d7c1d3825a3da4c0e54f371e30 Mon Sep 17 00:00:00 2001 From: George <122637419+georgescutelnicu@users.noreply.github.com> Date: Wed, 8 May 2024 18:56:11 +0300 Subject: [PATCH] Add scrollbar offset logic in HourlyDetails widget (#115) --- src/frontendHourlyDetails.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/frontendHourlyDetails.py b/src/frontendHourlyDetails.py index 3d53e24..e9c5974 100644 --- a/src/frontendHourlyDetails.py +++ b/src/frontendHourlyDetails.py @@ -261,3 +261,9 @@ def create_stack_page(self, page_name): label_val.set_margin_top(0) + # Add scrollbar offset + container_size = graphic_container.get_preferred_size()[1] + container_width = container_size.width + scrollbar_offset = (container_width / 24) * (nearest_current_time_idx - 2) + h_adjustment = Gtk.Adjustment(value=scrollbar_offset, lower=0, upper=container_width) + scrolled_window.set_hadjustment(h_adjustment)