WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Centering texture (https://www.wowinterface.com/forums/showthread.php?t=59801)

Benalish 02-20-24 07:45 AM

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()

Fizzlemizz 02-20-24 09:00 AM

What version of the game is this for?

Benalish 02-20-24 10:43 AM

Taken from this: https://github.com/nickbender/wow-in...olorPicker.lua

Fizzlemizz 02-20-24 10:53 AM

Ahh, the code is from the WoD version of ElveUI.

Also, because the workings of the ColourPickerFrame changed in 10.2.5 and I don't believe the Classics have caught up with the changes yet.

From a best guess, I'd say the (presumably) Button frame in the centre of the image is using a standard Blizz. edgeFile for the backdrop that is designed to look like a 3D picture frame with a light shining down from the top left, casting a shadow on the bottom right.

You need to find a flat border edge file or go with something different (maybe just a flat outer texture and a second inner texture (swatch) to display the changing colours?)

Actually the texture use in the code ("Interface\\ChatFrame\\ChatFrameColorSwatch") is pretty flat and used by current Ace. See any addon that has a colour select option and uses Ace (eg. Mapster)


All times are GMT -6. The time now is 11:41 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI