Fix returned `percent` when clicking the `Scrollbar` `track`
This commit is contained in:
parent
d1c3fc0f1c
commit
0dc6043dc7
|
@ -189,8 +189,9 @@ function Scrollbar:_on_mouse_pressed_normal(button, x, y, clicks)
|
||||||
self.drag_start_offset = along - y
|
self.drag_start_offset = along - y
|
||||||
return true
|
return true
|
||||||
elseif overlaps == "track" then
|
elseif overlaps == "track" then
|
||||||
|
local nr = self.normal_rect
|
||||||
self.drag_start_offset = - along_size / 2
|
self.drag_start_offset = - along_size / 2
|
||||||
return (y - self.normal_rect.along - along_size / 2) / self.normal_rect.along_size
|
return common.clamp((y - nr.along - along_size / 2) / (nr.along_size - along_size), 0, 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue