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 if self.updateLock then return end
self.updateLock = true self.updateLock = true
local status = self.status or self.localstatus 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 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 -- 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! -- 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 if self.scrollBarShown then
self.scrollBarShown = nil self.scrollBarShown = nil
self.scrollbar:Hide() scrollbar:Hide()
self.scrollbar:SetValue(0) scrollbar:SetValue(0)
self.scrollframe:SetPoint("BOTTOMRIGHT", 0, 0) scrollframe:SetPoint("BOTTOMRIGHT",0,0)
self:DoLayout() self:DoLayout()
end end
offset = 0
else else
if not self.scrollBarShown then if not self.scrollBarShown then
self.scrollBarShown = true self.scrollBarShown = true
self.scrollbar:Show() scrollbar:Show()
self.scrollframe:SetPoint("BOTTOMRIGHT", -20, 0) scrollframe:SetPoint("BOTTOMRIGHT", -20, 0)
self:DoLayout() self:DoLayout()
end end
local value = (offset / (viewheight - height) * 1000) local value = (offset / (height - viewheight) * 1000)
if value > 1000 then value = 1000 end if value > 1000 then
self.scrollbar:SetValue(value) value = 1000
self:SetScroll(value) offset = height - viewheight
if value < 1000 then
self.content:ClearAllPoints()
self.content:SetPoint("TOPLEFT", 0, offset)
self.content:SetPoint("TOPRIGHT", 0, offset)
status.offset = offset
end end
scrollbar:SetValue(value)
self:SetScroll(value)
end end
status.offset = offset
scrollframe:SetScrollChild(content)
content:ClearAllPoints()
content:SetPoint("TOPLEFT", 0, offset)
content:SetPoint("TOPRIGHT", 0, offset)
self.updateLock = nil self.updateLock = nil
end, end,