temp fix AceGUIContainer-ScrollFrame

This commit is contained in:
Bunny67
2018-07-21 17:03:28 +03:00
parent 8fd5b74c6b
commit 0ca8e5dc06
@@ -93,37 +93,42 @@ local methods = {
if self.updateLock then return end
self.updateLock = true
local status = self.status or self.localstatus
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
local scrollframe, content, scrollbar = self.scrollframe, self.content, self.scrollbar
local viewheight, height = self.scrollframe:GetHeight(), self.content:GetHeight()
local offset = status.offset or 0
local curvalue = self.scrollbar:GetValue()
local curvalue = scrollbar:GetValue()
-- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracys
-- No-one is going to miss 2 pixels at the bottom of the frame, anyhow!
if viewheight < height + 2 then
if height < viewheight + 2 then
if self.scrollBarShown then
self.scrollBarShown = nil
self.scrollbar:Hide()
self.scrollbar:SetValue(0)
self.scrollframe:SetPoint("BOTTOMRIGHT", 0, 0)
scrollbar:Hide()
scrollbar:SetValue(0)
scrollframe:SetPoint("BOTTOMRIGHT",0,0)
self:DoLayout()
end
offset = 0
else
if not self.scrollBarShown then
self.scrollBarShown = true
self.scrollbar:Show()
self.scrollframe:SetPoint("BOTTOMRIGHT", -20, 0)
scrollbar:Show()
scrollframe:SetPoint("BOTTOMRIGHT", -20, 0)
self:DoLayout()
end
local value = (offset / (viewheight - height) * 1000)
if value > 1000 then value = 1000 end
self.scrollbar:SetValue(value)
self:SetScroll(value)
if value < 1000 then
self.content:ClearAllPoints()
self.content:SetPoint("TOPLEFT", 0, offset)
self.content:SetPoint("TOPRIGHT", 0, offset)
status.offset = offset
local value = (offset / (height - viewheight) * 1000)
if value > 1000 then
value = 1000
offset = height - viewheight
end
scrollbar:SetValue(value)
self:SetScroll(value)
end
status.offset = offset
scrollframe:SetScrollChild(content)
content:ClearAllPoints()
content:SetPoint("TOPLEFT", 0, offset)
content:SetPoint("TOPRIGHT", 0, offset)
self.updateLock = nil
end,