better scrollbar handling

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@199 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-07 09:16:20 +00:00
parent cda915091e
commit 398eba64f7

View File

@@ -130,8 +130,6 @@ static void draw(MwWidget handle) {
}
static void mouse_move(MwWidget handle) {
int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight);
int or = MwGetInteger(handle, MwNorientation);
scrollbar_t* scr = handle->internal;
@@ -144,13 +142,9 @@ static void mouse_move(MwWidget handle) {
int max = MwGetInteger(handle, MwNmaxValue);
if(or == MwVERTICAL) {
int tri = (ww - MwDefaultBorderWidth * 2) + MwDefaultBorderWidth;
l = handle->mouse_point.y - tri + scr->pos;
len -= tri * 2;
l = handle->mouse_point.y + scr->pos;
} else if(or == MwHORIZONTAL) {
int tri = (wh - MwDefaultBorderWidth * 2) + MwDefaultBorderWidth;
l = handle->mouse_point.x - tri + scr->pos;
len -= tri * 2;
l = handle->mouse_point.x + scr->pos;
}
len = l / len;