I would like to resize a frame with the mouse, just like the chat frame resizing, however i don't want anything fancy i just want to increase and decrase the scale of the frame based on the mouse's position. Here is my code so far:
Lua Code:
local function LeftButtonOnUpdate(frame, elapsed)
--frame.x = math.floor(frame:GetLeft() + (frame:GetWidth() - UIParent:GetWidth()) / 2 + 0.5)
--frame.y = math.floor(frame:GetTop() - (frame:GetHeight() + UIParent:GetHeight()) / 2 + 0.5)
FRAMETORESIZE:SetScale(FRAMETORESIZE:GetScale() * 1.001)
end
local function SizeOnMouseDown(frame, button)
if button == "LeftButton" then
frame.x, frame.y = GetCursorPosition()
frame:SetScript("OnUpdate", LeftButtonOnUpdate)
end
end
local function SizeOnMouseUp(frame, button)
if button == "LeftButton" then
frame:SetScript("OnUpdate", nil)
end
end
function ResizeStart(frame)
frame:SetScript("OnMouseDown", SizeOnMouseDown)
frame:SetScript("OnMouseUp", SizeOnMouseUp)
end