Skip to content

Commit

Permalink
allow dragging the music wheel scroll bar
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Aug 5, 2021
1 parent 232ea03 commit 1355068
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions Themes/Til Death/Graphics/ScrollBar TickThumb.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
local t = Def.ActorFrame {}
local screname
local whee
t[#t + 1] =
Def.ActorFrame {
local mdown = false -- mouse down mouse up
local prev = 0 -- previous wheel index moved to to prevent holding the mouse down causing a lot of clicky noises
t[#t + 1] = Def.ActorFrame {
BeginCommand = function(self)
SCREENMAN:GetTopScreen():AddInputCallback(function(event)
if event.DeviceInput.button == "DeviceButton_left mouse button" then
if event.type ~= "InputEventType_Release" then
mdown = true

self:SetUpdateFunction(function(self)
local mx = SCREEN_WIDTH - INPUTFILTER:GetMouseX()
local my = SCREEN_HEIGHT - INPUTFILTER:GetMouseY()
if mx < 32 and mx > 0 and my < 440 and my > 48 then
self:playcommand("ClickingMusicWheelScroller")
end
end)
else
mdown = false
self:SetUpdateFunction(nil)
end
end
end)
end,

Def.Quad {
Name = "DootyMcBooty",
BeginCommand = function(self)
Expand All @@ -12,20 +34,19 @@ t[#t + 1] =
whee = SCREENMAN:GetTopScreen():GetMusicWheel()
end
end,
MouseLeftClickMessageCommand = function(self)
ClickingMusicWheelScrollerCommand = function(self)
if whee then
local my = SCREEN_HEIGHT - INPUTFILTER:GetMouseY()
local mx = SCREEN_WIDTH - INPUTFILTER:GetMouseX()
if mx < 32 and mx > 0 and my < 440 and my > 48 then
local idx = whee:GetCurrentIndex()
local num = whee:GetNumItems()
local dum = (INPUTFILTER:GetMouseY() - 45) / (SCREEN_HEIGHT - 103)
whee:Move(notShit.round(num * dum) - idx)
local idx = whee:GetCurrentIndex()
local num = whee:GetNumItems()
local dum = (INPUTFILTER:GetMouseY() - 45) / (SCREEN_HEIGHT - 103)
local newmove = notShit.round(num * dum) - idx
if newmove ~= prev then
prev = notShit.round(num * dum) - idx
whee:Move(prev)
whee:Move(0)
end
end
end
}
}

return t

0 comments on commit 1355068

Please sign in to comment.