From 2130592b46aa91618280fcb3394e42d728aee01d Mon Sep 17 00:00:00 2001 From: stpain Date: Fri, 9 Feb 2024 11:37:59 +0000 Subject: [PATCH] Fixed the resize issue on classic Added the new resize button template from blizzard and hooked a script to trigger the UI update --- .vscode/settings.json | 9 +++++++++ ViragDevTool.lua | 35 +++++++++++++++++++++++++++++++++++ ViragDevTool.xml | 33 ++++++++++++++++++++++----------- 3 files changed, 66 insertions(+), 11 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..187da42 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "Lua.diagnostics.globals": [ + "HybridScrollFrame_CreateButtons", + "HybridScrollFrame_GetOffset", + "HybridScrollFrame_Update", + "SlashCmdList", + "ColorPickerFrame" + ] +} \ No newline at end of file diff --git a/ViragDevTool.lua b/ViragDevTool.lua index 99356eb..1cc96f3 100644 --- a/ViragDevTool.lua +++ b/ViragDevTool.lua @@ -469,6 +469,19 @@ end ----------------------------------------------------------------------------------------------- -- UI ----------------------------------------------------------------------------------------------- + + +function ViragDevTool:OnUpdate() + if self.isUiUpdateEnabled then + self:DragResizeColumn(self.wndRef.columnResizer, true) + self:UpdateMainTableUI(true) + self:UpdateSideBarUI() + end +end + + + + function ViragDevTool:UpdateUI() self:UpdateMainTableUI() self:UpdateSideBarUI() @@ -595,7 +608,13 @@ function ViragDevTool:UpdateMainTableUI(force) HybridScrollFrame_Update(scrollFrame, totalRowsCount * buttons[1]:GetHeight(), scrollFrame:GetHeight()); + -- local scrollWidth = scrollFrame:GetWidth() + -- local parentWidth = self.wndRef:GetWidth() + -- local scrollChildWidth = scrollFrame.scrollChild:GetWidth() + -- print(string.format("Parent: %s, Scroll %s, Child %s", parentWidth, scrollWidth, scrollChildWidth)) + scrollFrame.scrollChild:SetWidth(scrollFrame:GetWidth()) + end function ViragDevTool:UpdateScrollFrameRowSize(scrollFrame) @@ -1052,6 +1071,22 @@ end function ViragDevTool:OnLoad(mainFrame) self.wndRef = mainFrame + self.wndRef.resize:HookScript("OnMouseDown", function() + self.isUiUpdateEnabled = true; + end) + self.wndRef.resize:HookScript("OnMouseUp", function() + self.isUiUpdateEnabled = false; + end) + + self.wndRef:SetScript("OnUpdate", function() + if not self.wndRef:IsVisible() then + return + end + if self.isUiUpdateEnabled then + self:OnUpdate() + end + end) + self.wndRef:RegisterEvent("ADDON_LOADED") self.wndRef:RegisterEvent("PLAYER_ENTERING_WORLD") --VARIABLES_LOADED self.wndRef:SetScript("OnEvent", function(this, event, addonName, ...) diff --git a/ViragDevTool.xml b/ViragDevTool.xml index f9f1547..50cfae7 100644 --- a/ViragDevTool.xml +++ b/ViragDevTool.xml @@ -313,25 +313,32 @@ ViragDevTool:OnLoad(self) self:SetUserPlaced(true) - self:SetMinResize(635, 200); - self:SetMaxResize(UIParent:GetWidth(), UIParent:GetHeight()); + + self.resize:Init(self, 500, 300, 1100, 800) self:RegisterForDrag("LeftButton"); - + self:StartMoving() - -- self.columnResizer: - - self.isMoving = false - self:StopMovingOrSizing(); + self:StopMovingOrSizing() + - + + + + + +