Quantcast

ScrollFrame Resize fix

Petr Grabovoy [05-28-16 - 18:10]
ScrollFrame Resize fix
Filename
ViragDevTool.lua
ViragDevTool.xml
diff --git a/ViragDevTool.lua b/ViragDevTool.lua
index c5feff6..e682f7f 100644
--- a/ViragDevTool.lua
+++ b/ViragDevTool.lua
@@ -137,11 +137,16 @@ function ViragDevTool_ClearData()
     ViragDevToolLinkedList:Clear()
     ViragDevTool_ScrollBar_Update()
 end
-
+local ViragDevToolScrollFrameSize = 0;
 function ViragDevTool_ScrollBar_Update()

     local scrollFrame = ViragDevToolScrollFrame

+    if (scrollFrame:GetHeight() > ViragDevToolScrollFrameSize) then
+        ViragDevToolScrollFrameSize = scrollFrame:GetHeight()
+        HybridScrollFrame_CreateButtons(scrollFrame, "ViragDevToolEntryTemplate", 0, -2)
+    end
+
     local buttons = scrollFrame.buttons;
     local offset = HybridScrollFrame_GetOffset(scrollFrame)
     local totalRowsCount = ViragDevToolLinkedList.size
diff --git a/ViragDevTool.xml b/ViragDevTool.xml
index 5000075..26d7131 100644
--- a/ViragDevTool.xml
+++ b/ViragDevTool.xml
@@ -108,7 +108,7 @@
                 ViragDevTool_ScrollBar_Update()
             </OnReceiveDrag>
             <OnDragStop>
-                HybridScrollFrame_CreateButtons(self.scrollFrame, "ViragDevToolEntryTemplate", 0, -2)
+                ViragDevTool_ScrollBar_Update()
                 self:StopMovingOrSizing();
             </OnDragStop>
         </Scripts>
@@ -141,7 +141,6 @@
                 </Anchors>
                 <Scripts>
                     <OnShow>
-                        HybridScrollFrame_CreateButtons(self, "ViragDevToolEntryTemplate", 0, -2)
                         ViragDevTool_ScrollBar_Update()
                     </OnShow>