Bagnon

Bagnon

127M Downloads

Frame restores to the right of the saved position when UIParent:SetSize() is set smaller than the screen dimensions

dstaley opened this issue ยท 2 comments

commented

Running Software (issues missing this information will be deleted):

  • Addon version: 9.0.3-9.0.1
  • Server patch: [e.g. Build 8.0.1.27178] 9.0.1

Have you read the changelog? (please don't waste our time)
Yes

Describe the bug
When used in combination with SurroundFix, the Bagnon frame restores to the left of the saved position. I'm able to drag the frame to a position, but the frame will restore to the right of that position. If I continually dismiss and restore the frame, it continually moves to the right.

To Reproduce
Steps to reproduce the behaviour:

  1. Install SurroundFix addon
  2. Run /sfix aspect 4:3 in chat
  3. Open Bagnon window
  4. Move Bagnon window
  5. Dismiss Bagnon window

Expected behaviour
Bagnon window is restored to the same position it was in when it was closed.

Screenshots
Video recording

Error Logs
N/A

Additional context
The Bagnon window is able to be moved to arbitrary locations even with SurroundFix active, but the position that it's restored to is incorrect. My guess is that there's some UIParent-aware behavior in the move logic that's missing in the persist/restore position logic. Additionally, the window always restores to the same distance from the dismissed position. This only occurs when the aspect ratio passed to SurroundFix is smaller than the aspect ratio of the display. The smaller the difference, the smaller the offset of the Bagnon window from its dismissed position.

Interestingly, Combuctor doesn't have the exact same issue. On the first restore, Combuctor will restore to the right of the dismissed position, but subsequent dismissals/restores occur at the original position. So I can actually just move it a bit to the right of where I actually want it to be, and it'll jump to the right only once.

commented

SurroundFix dev here, just thought I'd quickly add what I believe causes it.
All my addon does at it's core is resize UIParent with UIParent:SetSize(x,y), so there's not really anything I can do on my end to fix this interaction.

I believe that this bug is caused by Bagnon not saving and loading it's position correctly with respect to UIParent. From past experience, this is normally caused by saving the absolute position on the screen, then loading the position relative to UIParent. One thing that makes me believe this is the case is that it will always move to the right the exact distance from the left edge of the game world to the left edge of the UI.

The obvious fix is to make sure that both saving and loading position are relative to UIParent.

I believe that the Combuctor example is also due to the same issue, but its specific behaviour will be due to it not saving its position on every dismissal and only saving it on move.

commented

Not experienced with Github and pull requests (sorry!) but the problem is the positioning code in \Wildpants\classes\frame.lua saving out everything screen relative. This rewrite fixes it:

function Frame:RecomputePosition()
	local point, _,_, x, y = self:GetPoint()
	if point and x and y then
		self:SetPosition(point, x, y)
	end
end