libdraw: fix wrong menusel() calculation for menuhit() (noticable with small fonts)
the text for a menu entry is drawn from: y = textr.min.y + i*(font->height+Vspacing); but we calculated the item from: r = insetrect(textr); i = (p.y - r.min.y) / (font->height+Vspacing); the insetrect is wrong.
This commit is contained in:
parent
4041ea394b
commit
7295fa71a4
2 changed files with 0 additions and 2 deletions
|
@ -68,7 +68,6 @@ menurect(Rectangle r, int i)
|
|||
static int
|
||||
menusel(Rectangle r, Point p)
|
||||
{
|
||||
r = insetrect(r, Margin);
|
||||
if(!ptinrect(p, r))
|
||||
return -1;
|
||||
return (p.y-r.min.y)/(font->height+Vspacing);
|
||||
|
|
|
@ -69,7 +69,6 @@ menurect(Rectangle r, int i)
|
|||
static int
|
||||
menusel(Rectangle r, Point p)
|
||||
{
|
||||
r = insetrect(r, Margin);
|
||||
if(!ptinrect(p, r))
|
||||
return -1;
|
||||
return (p.y-r.min.y)/(font->height+Vspacing);
|
||||
|
|
Loading…
Reference in a new issue