BodyAddChild PopupContext needs to happen immediately upon triggering it.

PiperOrigin-RevId: 881955422
Change-Id: I03675431d78c93550ff2ad6d562daf1a0e3d0d08
This commit is contained in:
Haroon Qureshi
2026-03-11 05:19:28 -07:00
committed by Copybara-Service
parent acf7f030a6
commit df02fe4bc0
+7 -6
View File
@@ -93,12 +93,6 @@ static void AddEditorButtons(mjsElement* element, mjsElement** selected_element,
if (ImGui::SmallButton(ICON_FA_PLUS)) { if (ImGui::SmallButton(ICON_FA_PLUS)) {
ImGui::OpenPopupOnItemClick("BodyAddChild", 0); ImGui::OpenPopupOnItemClick("BodyAddChild", 0);
} }
ImGui::SameLine();
}
if (ImGui::SmallButton(ICON_FA_TRASH_CAN)) {
editor.DeleteActiveElement();
*selected_element = nullptr;
}
if (ImGui::BeginPopupContextItem("BodyAddChild")) { if (ImGui::BeginPopupContextItem("BodyAddChild")) {
mjsBody* body = mjs_asBody(element); mjsBody* body = mjs_asBody(element);
@@ -115,6 +109,13 @@ static void AddEditorButtons(mjsElement* element, mjsElement** selected_element,
option("Site", mjOBJ_SITE); option("Site", mjOBJ_SITE);
ImGui::EndPopup(); ImGui::EndPopup();
} }
ImGui::SameLine();
}
if (ImGui::SmallButton(ICON_FA_TRASH_CAN)) {
editor.DeleteActiveElement();
*selected_element = nullptr;
}
} }
static void SelectableElement(mjsElement* element, static void SelectableElement(mjsElement* element,