-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransmogrifyResize.lua
75 lines (63 loc) · 3.41 KB
/
TransmogrifyResize.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
local f, events = CreateFrame("Frame"), {};
f:RegisterEvent("TRANSMOGRIFY_OPEN")
--f:RegisterAllEvents();
f:SetScript("OnEvent", function(self,event, ...)
if event == "TRANSMOGRIFY_OPEN" then
-- print("Improving Transmog window...")
ResizeTransmogrify();
end
end)
local isAddedResize = false
function ResizeTransmogrify(frameWidth, frameHeight)
if frameWidth == nil then
frameWidth = GetScreenWidth() - 460; -- 1462
end
if frameHeight == nil then
frameHeight = GetScreenHeight() - 240; -- 841
end
local modelSceneWidth = frameWidth - 662; -- 800
local modelSceneHeight = frameHeight - 111; -- 730
if WardrobeFrame ~= nil then
WardrobeFrame:SetWidth(frameWidth);
WardrobeFrame:SetHeight(frameHeight);
WardrobeTransmogFrame.ModelScene:SetWidth(modelSceneWidth);
WardrobeTransmogFrame:SetWidth(modelSceneWidth);
WardrobeTransmogFrame:SetHeight(modelSceneHeight);
WardrobeTransmogFrame.ModelScene:SetHeight(modelSceneHeight);
WardrobeTransmogFrame.Inset.BG:SetWidth(modelSceneWidth);
WardrobeTransmogFrame.Inset.BG:SetHeight(modelSceneHeight);
WardrobeTransmogFrame.HeadButton:SetPoint("LEFT", WardrobeTransmogFrame.ModelScene,"LEFT", 15, 100);
WardrobeTransmogFrame.HandsButton:SetPoint("TOPRIGHT", WardrobeTransmogFrame.ModelScene,"TOPRIGHT", -15, 0);
WardrobeTransmogFrame.MainHandButton:SetPoint("BOTTOM", WardrobeTransmogFrame.ModelScene,"BOTTOM", -50, 15);
WardrobeTransmogFrame.SecondaryHandButton:SetPoint("BOTTOM", WardrobeTransmogFrame.ModelScene,"BOTTOM", 50, 15);
WardrobeTransmogFrame.MainHandEnchantButton:SetPoint("BOTTOM", WardrobeTransmogFrame.ModelScene,"BOTTOM", 100, 20);
WardrobeTransmogFrame.SecondaryHandEnchantButton:SetPoint("BOTTOM", WardrobeTransmogFrame.ModelScene,"BOTTOM", 100, 20);
WardrobeTransmogFrame.ToggleSecondaryAppearanceCheckbox:SetPoint("LEFT", WardrobeTransmogFrame.ModelScene,"TOPRIGHT", 50, -200);
WardrobeFrame:ClearAllPoints();
WardrobeFrame:SetPoint("CENTER", UIParent ,"CENTER",0,0);
if isAddedResize == false then
local resizeButton = CreateFrame("Button", nil, WardrobeFrame)
resizeButton:SetSize(16, 16)
resizeButton:SetPoint("BOTTOMRIGHT")
resizeButton:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Up")
resizeButton:SetHighlightTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Highlight")
resizeButton:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Down")
resizeButton:SetScript("OnMouseDown", function(self, button)
WardrobeFrame:SetResizable(true)
WardrobeFrame:StartSizing("BOTTOMRIGHT")
WardrobeFrame:SetUserPlaced(true)
end)
resizeButton:SetScript("OnMouseUp", function(self, button)
WardrobeFrame:StopMovingOrSizing()
local newWidth = WardrobeFrame:GetWidth()
local newHeight = WardrobeFrame:GetHeight()
ResizeTransmogrify(newWidth, newHeight);
end)
isAddedResize = true
end
else
print("TransmogrifyResize: Event occured but no Wardrobe found.")
end
-- WardrobeFrame:SetUserPlaced(true);
end