Skip to content

Commit

Permalink
feat(ui): Right-Click on compartment opens options [[gh#99](#99)]
Browse files Browse the repository at this point in the history
  • Loading branch information
exochron committed Dec 9, 2023
1 parent 642a4f2 commit 071cb42
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
25 changes: 25 additions & 0 deletions AddonCompartment.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
local ADDON_NAME, ADDON = ...

AddonCompartmentFrame:RegisterAddon({
text = C_AddOns.GetAddOnMetadata(ADDON_NAME, "Title"),
icon = C_AddOns.GetAddOnMetadata(ADDON_NAME, "IconTexture"),
registerForAnyClick = true,
notCheckable = true,
func = function(_, _, _, _, mouseButton)
if mouseButton == "RightButton" then
ADDON:OpenOptions()
else
ToggleCollectionsJournal(COLLECTIONS_JOURNAL_TAB_INDEX_MOUNTS)
end
end,
funcOnEnter = function(menuItem)
GameTooltip:SetOwner(menuItem, "ANCHOR_CURSOR")
GameTooltip:SetText("|T" .. C_AddOns.GetAddOnMetadata(ADDON_NAME, "IconTexture") .. ":0|t " .. C_AddOns.GetAddOnMetadata(ADDON_NAME, "Title"))
GameTooltip:AddLine(" ")
GameTooltip:AddLine(ADDON.L.COMPARTMENT_TOOLTIP)
GameTooltip:Show()
end,
funcOnLeave = function()
GameTooltip:Hide()
end,
})
1 change: 1 addition & 0 deletions Locals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local L = ADDON.L

L["AUTO_ROTATE"] = "Rotate automatically"
L["Black Market"] = "Black Market"
L["COMPARTMENT_TOOLTIP"] = "|cffeda55fLeft-Click|r to toggle showing the mount collection.\n|cffeda55fRight-Click|r to open addon options."
L["DRESSUP_LABEL"] = "Journal"
L["FAVOR_AUTO"] = "Auto-favor new mounts"
L["FAVOR_DISPLAYED"] = "All Displayed"
Expand Down
5 changes: 0 additions & 5 deletions MountJournalEnhanced.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,3 @@ end, ADDON_NAME)
if LE_FRAME_TUTORIAL_MOUNT_COLLECTION_DRAGONRIDING then
C_CVar.SetCVarBitfield("closedInfoFrames", LE_FRAME_TUTORIAL_MOUNT_COLLECTION_DRAGONRIDING, true)
end

-- for addon compartment
function MountJournalEnhanced_Open()
ToggleCollectionsJournal(COLLECTIONS_JOURNAL_TAB_INDEX_MOUNTS)
end
2 changes: 1 addition & 1 deletion MountJournalEnhanced.toc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
## Version: @project-version@
## SavedVariablesPerCharacter: MJEPersonalSettings
## SavedVariables: MJEGlobalSettings, MJETrackingData
## AddonCompartmentFunc: MountJournalEnhanced_Open
## X-Curse-Project-ID: 86372
## X-Wago-ID: nQN5m7NB

Expand Down Expand Up @@ -38,6 +37,7 @@ Settings\OptionsPanel.lua
Favorites.lua
Tracking.lua
SlashCommand.lua
AddonCompartment.lua
#@do-not-package@
DevZone\Debug.lua
DevZone\Screenshot.lua
Expand Down

0 comments on commit 071cb42

Please sign in to comment.