Skip to content

Commit

Permalink
Add DataText selection dropdown for /tukui dt
Browse files Browse the repository at this point in the history
  • Loading branch information
tukz committed Oct 9, 2024
1 parent c8bcdce commit cc0568f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
26 changes: 25 additions & 1 deletion Tukui/Modules/DataTexts/Anchors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,37 @@ DataTexts.Remove = function()
end

local OnMouseDown = function(self)
CurrentFrame = self

if Menu then
T.Miscellaneous.DropDown.DisplayDataTexts(self)
DataTexts.DisplayDataTextsDropDown(CurrentFrame)
else
T.Miscellaneous.DropDown.Open(DataMenu, MenuFrame, "cursor", 0 , 0, "MENU", 2)
end
end

function DataTexts:SwitchDataText()
local Object = DataTexts:GetDataText(self)

if Object then
DataTexts:Toggle(Object)
else
DataTexts:Remove()
end
end

function DataTexts:DisplayDataTextsDropDown()
MenuUtil.CreateContextMenu(self, function(Region, Description)
for Number, DataText in pairs(DataTexts.Menu) do
local Name = DataText.text

Description:CreateButton(DataText.text, function()
DataTexts.SwitchDataText(Name)
end)
end
end)
end

function DataTexts:ToggleDataPositions()
if Active then
for i = 1, self.NumAnchors do
Expand Down
14 changes: 0 additions & 14 deletions Tukui/Modules/Miscellaneous/DropDown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@ local UIDropDownMenu_CreateFrames = UIDropDownMenu_CreateFrames
local DropDown = CreateFrame("Frame")
local DataTexts = T["DataTexts"]

-- WIP
function DropDown:Warning()
T.Print("Dropdown are currently being rewrote from scratch and will be available soon!")
end

function DropDown:DisplayDataTexts()
MenuUtil.CreateContextMenu(self, function(Region, Description)
for Number, DataText in pairs(DataTexts.Menu) do
Description:CreateButton(DataText.text, DropDown.Warning)
end
end)
end
-- WIP

function DropDown:Skin()
if Menu then
local Dropdown = Menu.GetManager():GetOpenMenu()
Expand Down

0 comments on commit cc0568f

Please sign in to comment.