mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Add right-click context menu to spellbook spell rows
Allows casting or copying a spell link from the context menu, mirroring WoW's standard spellbook right-click behavior.
This commit is contained in:
parent
9b8bc2e977
commit
8eb451aab5
1 changed files with 28 additions and 1 deletions
|
|
@ -666,9 +666,36 @@ void SpellbookScreen::render(game::GameHandler& gameHandler, pipeline::AssetMana
|
|||
|
||||
// Row selectable
|
||||
ImGui::Selectable("##row", false,
|
||||
ImGuiSelectableFlags_AllowDoubleClick, ImVec2(0, rowHeight));
|
||||
ImGuiSelectableFlags_AllowDoubleClick | ImGuiSelectableFlags_DontClosePopups,
|
||||
ImVec2(0, rowHeight));
|
||||
bool rowHovered = ImGui::IsItemHovered();
|
||||
bool rowClicked = ImGui::IsItemClicked(0);
|
||||
|
||||
// Right-click context menu
|
||||
if (ImGui::BeginPopupContextItem("##SpellCtx")) {
|
||||
ImGui::TextDisabled("%s", info->name.c_str());
|
||||
if (!info->rank.empty()) {
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled("(%s)", info->rank.c_str());
|
||||
}
|
||||
ImGui::Separator();
|
||||
if (!isPassive) {
|
||||
if (onCooldown) ImGui::BeginDisabled();
|
||||
if (ImGui::MenuItem("Cast")) {
|
||||
uint64_t tgt = gameHandler.hasTarget() ? gameHandler.getTargetGuid() : 0;
|
||||
gameHandler.castSpell(info->spellId, tgt);
|
||||
}
|
||||
if (onCooldown) ImGui::EndDisabled();
|
||||
}
|
||||
if (ImGui::MenuItem("Copy Spell Link")) {
|
||||
char linkBuf[256];
|
||||
snprintf(linkBuf, sizeof(linkBuf),
|
||||
"|cffffd000|Hspell:%u|h[%s]|h|r",
|
||||
info->spellId, info->name.c_str());
|
||||
pendingChatSpellLink_ = linkBuf;
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImVec2 rMin = ImGui::GetItemRectMin();
|
||||
ImVec2 rMax = ImGui::GetItemRectMax();
|
||||
auto* dl = ImGui::GetWindowDrawList();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue