Quantcast
WoWInterface - View Single Post - Overlapping NineSlice textures with ButtonFrameTemplate
View Single Post
03-28-20, 02:26 PM   #2
Vrul
An Onyxian Warder
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 361
I would resize the bottom corners and not hide the edges:
Code:
local myFrame = CreateFrame("Frame", "myFrame", UIparent, "ButtonFrameTemplate")
myFrame:SetPoint("TOPLEFT")
ButtonFrameTemplate_HidePortrait(myFrame)
myFrame:SetFrameStrata("HIGH")
myFrame:SetWidth(430)
myFrame:SetHeight(220)
 
local function ResizeCorner(parent, cornerName, newX, newY)
	local corner = parent[cornerName]
	local oldX, oldY = corner:GetSize()
	local L, R, T, B = 0, newX / oldX, 0, newY / oldY
	if cornerName:match("Right") then
		L, R = 1 - R, 1
	end
	if cornerName:match("Bottom") then
		T, B = 1 - B, 1
	end
	corner:SetSize(newX, newY)
	corner:SetTexCoord(L, R, T, B)
end

ResizeCorner(myFrame.NineSlice, "BottomLeftCorner", 36, 36)
ResizeCorner(myFrame.NineSlice, "BottomRightCorner", 36, 36)
  Reply With Quote