View Single Post
06-08-17, 08:58 AM   #2
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
This happens because you're trying to fit a square peg into a round hole. Your edge file is being drawn on fractioned pixels, meaning the calculations by the UI engine are uneven to the point where your frame's edges end up in between pixels to be drawn on screen.

Normally, this aliasing effect isn't that big a of a deal if you're using larger edge textures, but when you're down to 2 px borders, it matters how large your frame is and where it's placed on screen. This function can eliminate one such case, by forcing your frame to only allow even numbers for width and height:

Lua Code:
  1. -- Force the frame to redraw on even pixels.
  2. function frame:OnSizeChanged(width, height)
  3.     width, height = floor(width + 0.5), floor(height + 0.5)
  4.     self:SetSize(width - (width % 2), height - (height % 2))
  5. end
  6.  
  7. frame:SetScript('OnSizeChanged', frame.OnSizeChanged)

Note that this might cause an infinite loop since the size is set from within the handler that responds to size changes, but find a way to bake this function into your frame.

The other case in which this happens is placing a frame so that its size causes one of the border to not fit perfectly onto a pixel. This can be fixed by the same approach as the function I just posted, but operating on the x and y offsets of your frame:GetPoint() values.
__________________

Last edited by MunkDev : 06-08-17 at 09:05 AM.
  Reply With Quote