Fix sliders controls bad offset - especially visible in Palette with RGB scale 3 to 16
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1607 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
730903251c
commit
6800cb7b9e
26
src/engine.c
26
src/engine.c
@ -2862,8 +2862,6 @@ short Window_get_clicked_button(void)
|
|||||||
T_Special_button * temp4;
|
T_Special_button * temp4;
|
||||||
T_Dropdown_button * temp5;
|
T_Dropdown_button * temp5;
|
||||||
|
|
||||||
long max_slider_height;
|
|
||||||
|
|
||||||
Window_attribute1=Mouse_K;
|
Window_attribute1=Mouse_K;
|
||||||
|
|
||||||
// Test click on normal buttons
|
// Test click on normal buttons
|
||||||
@ -2978,30 +2976,20 @@ short Window_get_clicked_button(void)
|
|||||||
if (temp3->Nb_elements>temp3->Nb_visibles)
|
if (temp3->Nb_elements>temp3->Nb_visibles)
|
||||||
{
|
{
|
||||||
// If there is enough room to make the cursor move:
|
// If there is enough room to make the cursor move:
|
||||||
|
long mouse_pos;
|
||||||
max_slider_height=(temp3->Length-24);
|
|
||||||
|
|
||||||
// Window_attribute2 receives the position of the cursor.
|
// Window_attribute2 receives the position of the cursor.
|
||||||
if (temp3->Is_horizontal)
|
if (temp3->Is_horizontal)
|
||||||
{
|
mouse_pos =(Mouse_X-Window_pos_X) / Menu_factor_X - (temp3->Pos_X+12);
|
||||||
Window_attribute2 =(Mouse_X-Window_pos_X) / Menu_factor_X;
|
|
||||||
Window_attribute2-=(temp3->Pos_X+12+((temp3->Cursor_length-1)>>1));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
mouse_pos =(Mouse_Y-Window_pos_Y) / Menu_factor_Y - (temp3->Pos_Y+12);
|
||||||
Window_attribute2 =(Mouse_Y-Window_pos_Y) / Menu_factor_Y;
|
|
||||||
Window_attribute2-=(temp3->Pos_Y+12+((temp3->Cursor_length-1)>>1));
|
Window_attribute2 = mouse_pos * temp3->Nb_elements / (temp3->Length-24) - temp3->Nb_visibles/2;
|
||||||
}
|
|
||||||
Window_attribute2*=(temp3->Nb_elements-temp3->Nb_visibles);
|
|
||||||
|
|
||||||
if (Window_attribute2<0)
|
if (Window_attribute2<0)
|
||||||
Window_attribute2=0;
|
Window_attribute2=0;
|
||||||
else
|
else if (Window_attribute2+temp3->Nb_visibles>temp3->Nb_elements)
|
||||||
{
|
Window_attribute2=temp3->Nb_elements-temp3->Nb_visibles;
|
||||||
Window_attribute2 =Round_div(Window_attribute2,max_slider_height-temp3->Cursor_length);
|
|
||||||
if (Window_attribute2+temp3->Nb_visibles>temp3->Nb_elements)
|
|
||||||
Window_attribute2=temp3->Nb_elements-temp3->Nb_visibles;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the cursor moved
|
// If the cursor moved
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user