Skip to content

Commit

Permalink
fix (mvMenu): Resetting menu state if it's not open #2245
Browse files Browse the repository at this point in the history
  • Loading branch information
v-ein authored and hoffstadt committed Jan 10, 2024
1 parent 2082480 commit e006122
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/mvContainers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,18 @@ DearPyGui::draw_menu(ImDrawList* drawlist, mvAppItem& item, mvMenuConfig& config

ImGui::EndMenu();
}
else
{
// even if menu popup is not open, we still need to update the state
item.state.lastFrameUpdate = GContext->frame;
item.state.active = ImGui::IsItemActive();
item.state.activated = ImGui::IsItemActivated();
item.state.deactivated = ImGui::IsItemDeactivated();
item.state.focused = false;
item.state.hovered = false;
item.state.rectSize = { 0.0f, 0.0f };
item.state.contextRegionAvail = { ImGui::GetContentRegionAvail().x, ImGui::GetContentRegionAvail().y };
}
}

//-----------------------------------------------------------------------------
Expand Down

0 comments on commit e006122

Please sign in to comment.