Skip to content

Commit

Permalink
Fixed music probability screen erroring
Browse files Browse the repository at this point in the history
  • Loading branch information
bkacjios committed May 26, 2023
1 parent df50d9b commit a8c6765
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
8 changes: 8 additions & 0 deletions source/modules/gui/panels/musicprobability.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ function PANEL:MusicFileSlider()
self:SetTextFormat("%d%%")
end

function PANEL:SetValue(value)
self.m_pSlider:SetValue(value)
end

function PANEL:GetValue()
return self.m_pSlider:GetValue()
end

function PANEL:SetFileName(str)
self.m_pFileName:SetText(str)
end
Expand Down
15 changes: 9 additions & 6 deletions source/modules/gui/panels/scrollpanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ local PANEL = class.create("ScrollPanel", "Panel")
function PANEL:ScrollPanel()
self:super() -- Initialize our baseclass
self:DockPadding(0,0,0,0)
self:SetBGColor(color(215, 0, 0))

self.m_pCanvas = self:Add("Panel")
self.m_pCanvas:SetBGColor(color(215, 215, 215))

self.m_pCanvas.PerformLayout = function(this)
this:SizeToChildren(false, true)
if self.m_bNoSizing and this:GetHeight() < self:GetHeight() then
this:SetPos(0, (self:GetHeight()-this:GetHeight()) * 0.5)
end
end

-- Create the scroll bar
self.m_pVBar = self:Add("ScrollBar")
Expand Down Expand Up @@ -41,10 +49,6 @@ function PANEL:InnerWidth()
end

function PANEL:Rebuild()
self:GetCanvas():SizeToChildren(false, true)
if self.m_bNoSizing and self:GetCanvas():GetHeight() < self:GetHeight() then
self:GetCanvas():SetPos(0, (self:GetHeight()-self:GetCanvas():GetHeight()) * 0.5)
end
end

function PANEL:OnMouseWheeled(x, y)
Expand Down Expand Up @@ -83,8 +87,7 @@ function PANEL:PerformLayout()

self.m_pCanvas:SetPos(0, ypos)
self.m_pCanvas:SetWidth(wide)

self:Rebuild()
self.m_pCanvas:InvalidateLayout()
end

function PANEL:SetScroll(scroll)
Expand Down

0 comments on commit a8c6765

Please sign in to comment.