diff --git a/chat.lua b/chat.lua index 08117ce..84c9857 100644 --- a/chat.lua +++ b/chat.lua @@ -27,6 +27,16 @@ Chat.commands = { Chat:Print("|cff00cc66/todo tg|r - Toggle todo window"); Chat:Print("|cff00cc66/todo add|r {message} - Adds a message from chat"); print(" "); + end, + + ["reload"] = function() + if(core.mainFrame) then + core.mainFrame:SetSize(200,200) + core.mainFrame:ClearAllPoints() + core.mainFrame:SetPoint("BOTTOMRIGHT", "$parent", "BOTTOMRIGHT", -120, 30) + core.mainFrame:SetScale(1) + core.mainFrame:Show() + end end, -- ["example"] = { diff --git a/components/ResponsiveFrame.lua b/components/ResponsiveFrame.lua index be7fd14..3bd3def 100644 --- a/components/ResponsiveFrame.lua +++ b/components/ResponsiveFrame.lua @@ -59,15 +59,20 @@ function OnUpdate(self) cx = cx / self:GetEffectiveScale() - self:GetParent():GetLeft() cy = self:GetParent():GetHeight() - (cy / self:GetEffectiveScale() - self:GetParent():GetBottom() ) + + local tNewScale = cx / self:GetParent():GetWidth() local tx, ty = self:GetParent().x / tNewScale, self:GetParent().y / tNewScale local newScale = self:GetParent():GetScale() * tNewScale; if (newScale > 0) then - self:GetParent():ClearAllPoints() - self:GetParent():SetScale(self:GetParent():GetScale() * tNewScale) - self:GetParent():SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", tx, ty) - self:GetParent().x, self:GetParent().y = tx, ty + local finalScale = self:GetParent():GetScale() * tNewScale; + if(finalScale > 0.5) then + self:GetParent():ClearAllPoints() + self:GetParent():SetScale(self:GetParent():GetScale() * tNewScale) + self:GetParent():SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", tx, ty) + self:GetParent().x, self:GetParent().y = tx, ty + end end end end @@ -94,6 +99,10 @@ function OnMouseDown(self, button) self:GetParent():SetHeight(147) end + -- Fix a bug if you click too much in the scale button + self:GetParent():StartMoving() + self:GetParent():StopMovingOrSizing() + if button == "LeftButton" then self.isSizing = true self:GetParent():StartSizing("BOTTOMRIGHT") diff --git a/init.lua b/init.lua index 7a9a054..d493a5e 100644 --- a/init.lua +++ b/init.lua @@ -48,6 +48,6 @@ function core:Init(event, name) end - CreateFrame("Frame", "TodoChecklister", events, "TodoChecklisterTemplate"); + core.mainFrame = CreateFrame("Frame", "TodoChecklister", events, "TodoChecklisterTemplate"); end events:SetScript("OnEvent", core.Init); \ No newline at end of file