Skip to content

Commit

Permalink
Fix knowledge window mouse-over and click y offset.
Browse files Browse the repository at this point in the history
  • Loading branch information
pjbroad committed Nov 11, 2024
1 parent 7dbab78 commit 29a7826
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions knowledge.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ int mouseover_knowledge_handler(window_info *win, int mx, int my)
if(my>booklist_y_len)
return 0;
mx = (mx < (win->len_x-win->box_size)/2) ?0 :1;
if ((my -= text_border) < 0)
return 0;
my/=booklist_y_step;
knowledge_list[mx+2*(my+vscrollbar_get_pos (win->window_id, knowledge_scroll_id))].mouse_over=1;
return 0;
Expand Down Expand Up @@ -444,6 +446,8 @@ int click_knowledge_handler(window_info *win, int mx, int my, Uint32 flags)

selected_book = -1;
x = (x < (win->len_x-win->box_size)/2) ?0 :1;
if ((y -= text_border) < 0)
return 0;
y/=booklist_y_step;
idx = x + 2 *(y + vscrollbar_get_pos (win->window_id, knowledge_scroll_id));
if(idx < knowledge_count)
Expand Down

0 comments on commit 29a7826

Please sign in to comment.