bugfix
This commit is contained in:
@@ -11,7 +11,6 @@ local ROW_HEIGHT = 39
|
|||||||
function public.render(item_listing)
|
function public.render(item_listing)
|
||||||
|
|
||||||
FauxScrollFrame_Update(item_listing.scroll_frame, getn(item_listing.item_records), getn(item_listing.rows), ROW_HEIGHT)
|
FauxScrollFrame_Update(item_listing.scroll_frame, getn(item_listing.item_records), getn(item_listing.rows), ROW_HEIGHT)
|
||||||
item_listing.scroll_frame:Show()
|
|
||||||
local offset = FauxScrollFrame_GetOffset(item_listing.scroll_frame)
|
local offset = FauxScrollFrame_GetOffset(item_listing.scroll_frame)
|
||||||
|
|
||||||
local rows = item_listing.rows
|
local rows = item_listing.rows
|
||||||
@@ -47,7 +46,7 @@ function public.create(parent, on_click, selected)
|
|||||||
content:SetPoint('TOPLEFT', 0, -51)
|
content:SetPoint('TOPLEFT', 0, -51)
|
||||||
content:SetPoint('BOTTOMRIGHT', -15, 0)
|
content:SetPoint('BOTTOMRIGHT', -15, 0)
|
||||||
|
|
||||||
local scroll_frame = CreateFrame('ScrollFrame', gui.unique_name .. 'ScrollFrame', parent, 'FauxScrollFrameTemplate')
|
local scroll_frame = CreateFrame('ScrollFrame', gui.unique_name, parent, 'FauxScrollFrameTemplate')
|
||||||
scroll_frame:SetScript('OnVerticalScroll', function(self, offset)
|
scroll_frame:SetScript('OnVerticalScroll', function(self, offset)
|
||||||
FauxScrollFrame_OnVerticalScroll(ROW_HEIGHT, function() render(this.item_listing) end)
|
FauxScrollFrame_OnVerticalScroll(ROW_HEIGHT, function() render(this.item_listing) end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -195,19 +195,6 @@ local methods = {
|
|||||||
return st.sizes.numRows
|
return st.sizes.numRows
|
||||||
end,
|
end,
|
||||||
|
|
||||||
SetScrollOffset = function(st, offset)
|
|
||||||
local maxOffset = max(getn(st.rowData) - st.sizes.numRows, 0)
|
|
||||||
if not offset or offset < 0 or offset > maxOffset then
|
|
||||||
return -- invalid offset
|
|
||||||
end
|
|
||||||
|
|
||||||
local scrollPercent = offset / maxOffset
|
|
||||||
local maxPixelOffset = st.scrollFrame:GetVerticalScrollRange() + ST_ROW_HEIGHT * 2
|
|
||||||
local pixelOffset = scrollPercent * maxPixelOffset
|
|
||||||
FauxScrollFrame_SetOffset(st.scrollFrame, offset)
|
|
||||||
st.scrollFrame:SetVerticalScroll(pixelOffset)
|
|
||||||
end,
|
|
||||||
|
|
||||||
SetHighlighted = function(st, row)
|
SetHighlighted = function(st, row)
|
||||||
st.highlighted = row
|
st.highlighted = row
|
||||||
st:RefreshRows()
|
st:RefreshRows()
|
||||||
|
|||||||
Reference in New Issue
Block a user