Thread Tools Display Modes
Prev Previous Post   Next Post Next
02-20-24, 07:45 AM   #1
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 123
Centering texture

Hello,
Since the widgets provided by the AceGUI library have their position locked, I rewrote the widget from scratch. In the final result, however, you notice that the lower and right sides of the background are less visible than the upper and left ones.
How can I make the four sides equal?




MWE:
Lua Code:
  1. local test = CreateFrame("Frame",nil,UIParent)
  2. local backdrop = {
  3.     bgFile = "Interface\\Buttons\\WHITE8X8",
  4.     edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5.     tile = true,
  6.     tileSize = 8,
  7.     edgeSize = 16,
  8.     insets = {
  9.         left = 3,
  10.         right = 3,
  11.         top = 3,
  12.         bottom = 3
  13.     },
  14.    
  15. }
  16. test:SetBackdrop(backdrop)
  17. test:SetBackdropColor(0, 0, 0, .95)
  18. test:SetSize(150,150)
  19. test:SetPoint("CENTER")
  20.  
  21. local colorPicker = CreateFrame("Button",nil,test)
  22. colorPicker:SetSize(24,24)
  23. colorPicker:SetPoint("CENTER")
  24.  
  25. colorPicker.colorSwatch = colorPicker:CreateTexture(nil, "OVERLAY")
  26. colorPicker.colorSwatch:SetWidth(19)
  27. colorPicker.colorSwatch:SetHeight(19)
  28. colorPicker.colorSwatch:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch")
  29. colorPicker.colorSwatch:SetPoint("CENTER")
  30. colorPicker.colorSwatch:SetVertexColor(0, 0, 0)
  31.  
  32. colorPicker.texture = colorPicker:CreateTexture(nil, "BACKGROUND")
  33. colorPicker.texture:SetWidth(16)
  34. colorPicker.texture:SetHeight(16)
  35. colorPicker.texture:SetTexture(1, 1, 1)
  36. colorPicker.texture:SetPoint("CENTER", colorSwatch)
  37. colorPicker.texture:Show()
  38.  
  39. colorPicker.checkers = colorPicker:CreateTexture(nil, "BACKGROUND")
  40. colorPicker.checkers:SetWidth(14)
  41. colorPicker.checkers:SetHeight(14)
  42. colorPicker.checkers:SetTexture("Tileset\\Generic\\Checkers")
  43. colorPicker.checkers:SetTexCoord(.25, 0, 0.5, .25)
  44. colorPicker.checkers:SetDesaturated(true)
  45. colorPicker.checkers:SetVertexColor(1, 1, 1, 0.75)
  46. colorPicker.checkers:SetPoint("CENTER", colorSwatch)
  47. colorPicker.checkers:Show()
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Centering texture


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off