Skip to content

Commit a8c6765

Browse files
committed
Fixed music probability screen erroring
1 parent df50d9b commit a8c6765

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

source/modules/gui/panels/musicprobability.lua

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ function PANEL:MusicFileSlider()
2424
self:SetTextFormat("%d%%")
2525
end
2626

27+
function PANEL:SetValue(value)
28+
self.m_pSlider:SetValue(value)
29+
end
30+
31+
function PANEL:GetValue()
32+
return self.m_pSlider:GetValue()
33+
end
34+
2735
function PANEL:SetFileName(str)
2836
self.m_pFileName:SetText(str)
2937
end

source/modules/gui/panels/scrollpanel.lua

+9-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ local PANEL = class.create("ScrollPanel", "Panel")
33
function PANEL:ScrollPanel()
44
self:super() -- Initialize our baseclass
55
self:DockPadding(0,0,0,0)
6+
self:SetBGColor(color(215, 0, 0))
67

78
self.m_pCanvas = self:Add("Panel")
89
self.m_pCanvas:SetBGColor(color(215, 215, 215))
10+
11+
self.m_pCanvas.PerformLayout = function(this)
12+
this:SizeToChildren(false, true)
13+
if self.m_bNoSizing and this:GetHeight() < self:GetHeight() then
14+
this:SetPos(0, (self:GetHeight()-this:GetHeight()) * 0.5)
15+
end
16+
end
917

1018
-- Create the scroll bar
1119
self.m_pVBar = self:Add("ScrollBar")
@@ -41,10 +49,6 @@ function PANEL:InnerWidth()
4149
end
4250

4351
function PANEL:Rebuild()
44-
self:GetCanvas():SizeToChildren(false, true)
45-
if self.m_bNoSizing and self:GetCanvas():GetHeight() < self:GetHeight() then
46-
self:GetCanvas():SetPos(0, (self:GetHeight()-self:GetCanvas():GetHeight()) * 0.5)
47-
end
4852
end
4953

5054
function PANEL:OnMouseWheeled(x, y)
@@ -83,8 +87,7 @@ function PANEL:PerformLayout()
8387

8488
self.m_pCanvas:SetPos(0, ypos)
8589
self.m_pCanvas:SetWidth(wide)
86-
87-
self:Rebuild()
90+
self.m_pCanvas:InvalidateLayout()
8891
end
8992

9093
function PANEL:SetScroll(scroll)

0 commit comments

Comments
 (0)