Skip to content

Commit

Permalink
only draw frame and arror when has the exact item
Browse files Browse the repository at this point in the history
  • Loading branch information
zxkmm committed Nov 13, 2024
1 parent 16e7e5f commit 7d13ba1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion applications/services/gui/modules/variable_item_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ static void zapper_menu_draw(Canvas* canvas, VariableItemListModel* model) {
zapper_menu->current_page,
zapper_menu->total_pages);

const uint8_t draw_count = end_option - start_option;
//frame
#define GAP_SIZE_PX 1
#define FRAME_HEIGHT 14
for(int i = 0; i < 4; i++) {
for(int i = 0; i < draw_count; i++) {
uint8_t y = i * (FRAME_HEIGHT + GAP_SIZE_PX);
canvas_draw_rframe(canvas, 0, y, canvas_width(canvas), FRAME_HEIGHT, 3);
}
Expand All @@ -124,12 +125,15 @@ static void zapper_menu_draw(Canvas* canvas, VariableItemListModel* model) {
// ^
canvas_draw_triangle(
canvas, arrow_x, 16 - (16 - 9) / 2 - 3, ARROR_SIZE, ARROR_SIZE, CanvasDirectionBottomToTop);
if(draw_count == 1) return;
// <
canvas_draw_triangle(
canvas, arrow_x + 9 / 2, 24 - 2, ARROR_SIZE, ARROR_SIZE, CanvasDirectionRightToLeft);
if(draw_count == 2) return;
// >
canvas_draw_triangle(
canvas, arrow_x - 9 / 2 + 2, 40 - 4, ARROR_SIZE, ARROR_SIZE, CanvasDirectionLeftToRight);
if(draw_count == 3) return;
// v
canvas_draw_triangle(
canvas, arrow_x, 16 * 3 + 6 - 6, ARROR_SIZE, ARROR_SIZE, CanvasDirectionTopToBottom);
Expand Down

0 comments on commit 7d13ba1

Please sign in to comment.