From fac67acb75d2649223a468b50fe692767dfa4baf Mon Sep 17 00:00:00 2001 From: tekkub Date: Sun, 20 Dec 2009 18:16:08 -0700 Subject: [PATCH] Fix refresh "issue"? Closes #15 --- GnomishVendorShrinker.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/GnomishVendorShrinker.lua b/GnomishVendorShrinker.lua index 8329573..81dbed9 100644 --- a/GnomishVendorShrinker.lua +++ b/GnomishVendorShrinker.lua @@ -365,9 +365,10 @@ end) local offset = 0 GVS:EnableMouseWheel(true) GVS:SetScript("OnMouseWheel", function(self, value) scrollbar:SetValue(scrollbar:GetValue() - value * SCROLLSTEP) end) -GVS:SetScript("OnShow", function() - scrollbar:SetMinMaxValues(0, math.max(0, GetMerchantNumItems() - NUMROWS)) - scrollbar:SetValue(0) +GVS:SetScript("OnShow", function(self, noreset) + local max = math.max(0, GetMerchantNumItems() - NUMROWS) + scrollbar:SetMinMaxValues(0, max) + scrollbar:SetValue(noreset and math.min(scrollbar:GetValue(), max) or 0) Refresh() end) GVS:SetScript("OnHide", function() if StackSplitFrame:IsVisible() then StackSplitFrame:Hide() end end) @@ -380,7 +381,7 @@ MerchantBuyBackItem:SetPoint("BOTTOMLEFT", 189, 90) local function Show() for i=1,12 do _G["MerchantItem"..i]:Hide() end - if GVS:IsShown() then Refresh() else GVS:Show() end + if GVS:IsShown() then GVS:GetScript("OnShow")(GVS, true) else GVS:Show() end end hooksecurefunc("MerchantFrame_UpdateMerchantInfo", Show)