.:HyPeX:. Posted March 7, 2015 Share Posted March 7, 2015 Well this is weird, every time i click the position where it is is not remembered and jumps to 0... scrollbar = {} function scrollBar(_,_,cx,cy) if not scrollbar.oldx then return end local bx,by = 582,368 local mx,my = cx - scrollbar.oldx, cy - scrollbar.oldy if upanel.tab.achivements.scroll.moving1 then local start = by-338 local ending = by-166 local total = ending-start local oldprog = upanel.tab.achivements.scroll.list1 -- This is a 0-1 progress local current = (total * oldprog) outputChatBox(my.." "..my / (total / 338) ) local my = my local current = current + my local prog = current / 338 local prog = math.min(prog,1) local prog = math.max(prog,0) --outputChatBox(oldprog.. " "..prog) upanel.tab.achivements.scroll.list1 = prog end end addEventHandler('onClientKey',root,function(key,status) local bx,by = 582,366 if key == "mouse1" then if showingPanel then if tab == 1 then if isCursorShowing() then local cx,cy = getCursorPosition() local cx,cy = cx*x,cy*y if status then outputChatBox(cx.." "..x*0.525+22+bx-12) if cx > x*0.525+22+bx-12 and cx < x*0.525+22+bx then local progress = upanel.tab.achivements.scroll.list1 or 0.2 local start = by-338 local ending = by-166 local middle = ending-start local pos = middle*progress local by = by-338 + y*0.4+20 + pos if cy > by and cy < by + 166 then addEventHandler('onClientCursorMove',root,scrollBar) upanel.tab.achivements.scroll.moving1 = true scrollbar.oldx = cx scrollbar.oldy = cy end end else if upanel.tab.achivements.scroll.moving1 then removeEventHandler('onClientCursorMove',root,scrollBar) scrollbar = {} end end end end end end end) I tried doing the follow on the first function: local prog = current / total It works.. but the scrollbar kinda bugs on, moves faster than the mouse and not properly. Link to comment
Killer... Posted March 7, 2015 Share Posted March 7, 2015 Please, explain better you error. Because my english level is not very good. Link to comment
.:HyPeX:. Posted March 7, 2015 Author Share Posted March 7, 2015 The scrollbar just jumps to the top whenever i click to move it (And it was already moved down), and starts to move from there. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now