Add right-click context menu to player unit frame

Right-clicking the player name in the unit frame opens a popup with 'Open Character' (opens the character/equipment screen) and 'Toggle PvP' options, consistent with the existing right-click menus on party and raid frames.
This commit is contained in:
Kelsi 2026-03-11 22:36:58 -07:00
parent 18e42c22d4
commit 69fd0b03a2

View file

@ -1928,11 +1928,20 @@ void GameScreen::renderPlayerFrame(game::GameHandler& gameHandler) {
playerHp = playerMaxHp;
}
// Name in green (friendly player color) — clickable for self-target
// Name in green (friendly player color) — clickable for self-target, right-click for menu
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.3f, 1.0f, 0.3f, 1.0f));
if (ImGui::Selectable(playerName.c_str(), false, 0, ImVec2(0, 0))) {
gameHandler.setTarget(gameHandler.getPlayerGuid());
}
if (ImGui::BeginPopupContextItem("PlayerSelfCtx")) {
if (ImGui::Selectable("Open Character")) {
inventoryScreen.setCharacterOpen(true);
}
if (ImGui::Selectable("Toggle PvP")) {
gameHandler.togglePvp();
}
ImGui::EndPopup();
}
ImGui::PopStyleColor();
ImGui::SameLine();
ImGui::TextDisabled("Lv %u", playerLevel);