Skip to content

Commit 7ed269a

Browse files
committed
Simplify window resizing to accommodate 11.2 API changes
Fixes #16. In 11.2 Blizzard made it so ClearAllPoints() invalidates the rect immediately, rather than the rect continuing to be a target that we can query GetLeft() and GetTop() from.
1 parent c71a7aa commit 7ed269a

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

DevTool.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,10 @@ function DevTool:ResizeMainFrame()
410410
local left = self.MainWindow:GetLeft()
411411
local top = self.MainWindow:GetTop()
412412

413+
-- Pin the top left corner of the main window in place so we only resize from the bottom right corner
414+
self.MainWindow:ClearAllPoints()
415+
self.MainWindow:SetPoint("TOPLEFT", nil, "TOPLEFT", left, (-1 * (UIParent:GetHeight() - top)))
416+
413417
local x, y = GetCursorPosition()
414418
local s = self.MainWindow:GetEffectiveScale()
415419
x = x / s
@@ -426,8 +430,7 @@ function DevTool:ResizeMainFrame()
426430

427431
end
428432

429-
self.MainWindow:SetSize(DevTool.CalculatePosition(x - left, minX, maxX),
430-
DevTool.CalculatePosition(top - y, minY, maxY))
433+
self.MainWindow:SetSize(DevTool.CalculatePosition(x - left, minX, maxX), DevTool.CalculatePosition(top - y, minY, maxY))
431434
end
432435

433436
function DevTool:ResizeColumn(firstRun)
@@ -444,7 +447,8 @@ function DevTool:ResizeColumn(firstRun)
444447
end
445448

446449
self.MainWindow.columnResizer:ClearAllPoints()
447-
self.MainWindow.columnResizer:SetPoint("TOPRIGHT", self.MainWindow, "TOPRIGHT", self.db.profile.collResizeWidth * -1, -30) -- 30 is offset from above (top buttons)
450+
-- -30 is vertical offset from above (top buttons)
451+
self.MainWindow.columnResizer:SetPoint("TOPRIGHT", self.MainWindow, "TOPRIGHT", self.db.profile.collResizeWidth * -1, -30)
448452
end
449453

450454
-----------------------------------------------------------------------------------------------

XML/MainFrame.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,18 +328,13 @@ https://raw.githubusercontent.com/Gethe/wow-ui-source/live/Interface/FrameXML/UI
328328
self:RegisterForDrag("LeftButton");
329329
</OnLoad>
330330
<OnDragStart>
331-
self:GetParent():ClearAllPoints()
332-
self:GetParent():SetPoint("TOPLEFT", nil, "TOPLEFT",
333-
self:GetParent():GetLeft(), (-1 * (UIParent:GetHeight() - self:GetParent():GetTop())))
334331
self:SetButtonState("PUSHED", true);
335332
self:GetHighlightTexture():Hide();
336-
337333
self.updateTimer = DevTool:ScheduleRepeatingTimer("ResizeUpdateTick", 0.01)
338334
</OnDragStart>
339335
<OnDragStop>
340336
DevTool:CancelTimer(self.updateTimer)
341-
--call one final time to let go of the cursor
342-
DevTool:ResizeUpdateTick()
337+
DevTool:ResizeUpdateTick() --call one final time to let go of the cursor
343338
self:SetButtonState("NORMAL", false);
344339
self:GetHighlightTexture():Show();
345340
</OnDragStop>

0 commit comments

Comments
 (0)