From 04afd22943cf4d6a826e09cf5fd246886ee7cacf Mon Sep 17 00:00:00 2001 From: Steve Amor Date: Sat, 19 Jul 2025 07:20:07 +0100 Subject: Refactor pageindicator --- src/displayapp/widgets/PageIndicator.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/displayapp/widgets/PageIndicator.cpp') diff --git a/src/displayapp/widgets/PageIndicator.cpp b/src/displayapp/widgets/PageIndicator.cpp index 5d9815da..cee979f2 100644 --- a/src/displayapp/widgets/PageIndicator.cpp +++ b/src/displayapp/widgets/PageIndicator.cpp @@ -16,6 +16,10 @@ void PageIndicator::Create() { lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::bgDark); lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2); + + pageIndicator = lv_line_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_line_width(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); + lv_obj_set_style_local_line_color(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); SetPageIndicatorPosition(nCurrentScreen); } @@ -28,13 +32,5 @@ void PageIndicator::SetPageIndicatorPosition(uint8_t position) { pageIndicatorPoints[1].x = LV_HOR_RES - 1; pageIndicatorPoints[1].y = indicatorPos + indicatorSize; - pageIndicator = lv_line_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_line_width(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); - lv_obj_set_style_local_line_color(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); lv_line_set_points(pageIndicator, pageIndicatorPoints, 2); } - -void PageIndicator::SetCurrentScreen(uint8_t nScreen) { - lv_obj_del(pageIndicator); - SetPageIndicatorPosition(nScreen); -} -- cgit v1.2.3-70-g09d2