diff --git a/mm/2s2h/BenGui/BenInputEditorWindow.cpp b/mm/2s2h/BenGui/BenInputEditorWindow.cpp index 6d9d1f15d3..ba6d175492 100644 --- a/mm/2s2h/BenGui/BenInputEditorWindow.cpp +++ b/mm/2s2h/BenGui/BenInputEditorWindow.cpp @@ -216,6 +216,7 @@ void BenInputEditorWindow::DrawButtonLineAddMappingButton(uint8_t port, CONTROLL if (ImGui::Button(StringHelper::Sprintf("%s###addButtonMappingButton%d-%d", ICON_FA_PLUS, port, bitmask).c_str(), ImVec2(SCALE_IMGUI_SIZE(20.0f), 0.0f))) { ImGui::OpenPopup(popupId.c_str()); + OffsetMappingPopup(); }; ImGui::PopStyleVar(); @@ -279,6 +280,7 @@ void BenInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, CONTROL .c_str(), ImVec2(ImGui::CalcTextSize(physicalInputDisplayName.c_str()).x + SCALE_IMGUI_SIZE(12.0f), 0.0f))) { ImGui::OpenPopup(popupId.c_str()); + OffsetMappingPopup(); } if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_NoSharedDelay)) { ImGui::SetTooltip(mapping->GetPhysicalDeviceName().c_str()); @@ -326,6 +328,7 @@ void BenInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, CONTROL if (ImGui::Button(StringHelper::Sprintf("%s###editAxisThresholdButton%s", ICON_FA_COG, id.c_str()).c_str(), ImVec2(ImGui::CalcTextSize(ICON_FA_COG).x + SCALE_IMGUI_SIZE(10.0f), 0.0f))) { ImGui::OpenPopup(popupId.c_str()); + OffsetMappingPopup(); } if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_NoSharedDelay)) { ImGui::SetTooltip("Edit axis threshold"); @@ -466,6 +469,7 @@ void BenInputEditorWindow::DrawStickDirectionLineAddMappingButton(uint8_t port, .c_str(), ImVec2(SCALE_IMGUI_SIZE(20.0f), 0.0f))) { ImGui::OpenPopup(popupId.c_str()); + OffsetMappingPopup(); }; ImGui::PopStyleVar(); @@ -551,6 +555,7 @@ void BenInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port, .c_str(), ImVec2(ImGui::CalcTextSize(physicalInputDisplayName.c_str()).x + SCALE_IMGUI_SIZE(12.0f), 0.0f))) { ImGui::OpenPopup(popupId.c_str()); + OffsetMappingPopup(); } if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_NoSharedDelay)) { ImGui::SetTooltip(mapping->GetPhysicalDeviceName().c_str()); @@ -829,6 +834,7 @@ void BenInputEditorWindow::DrawAddRumbleMappingButton(uint8_t port) { if (ImGui::Button(StringHelper::Sprintf("%s###addRumbleMapping%d", ICON_FA_PLUS, port).c_str(), ImVec2(SCALE_IMGUI_SIZE(20.0f), SCALE_IMGUI_SIZE(20.0f)))) { ImGui::OpenPopup(popupId.c_str()); + OffsetMappingPopup(); } ImGui::PopStyleVar(); @@ -1012,6 +1018,7 @@ void BenInputEditorWindow::DrawAddLEDMappingButton(uint8_t port) { if (ImGui::Button(StringHelper::Sprintf("%s###addLEDMapping%d", ICON_FA_PLUS, port).c_str(), ImVec2(SCALE_IMGUI_SIZE(20.0f), SCALE_IMGUI_SIZE(20.0f)))) { ImGui::OpenPopup(popupId.c_str()); + OffsetMappingPopup(); } ImGui::PopStyleVar(); @@ -1091,6 +1098,7 @@ void BenInputEditorWindow::DrawAddGyroMappingButton(uint8_t port) { if (ImGui::Button(StringHelper::Sprintf("%s###addGyroMapping%d", ICON_FA_PLUS, port).c_str(), ImVec2(SCALE_IMGUI_SIZE(20.0f), SCALE_IMGUI_SIZE(20.0f)))) { ImGui::OpenPopup(popupId.c_str()); + OffsetMappingPopup(); } ImGui::PopStyleVar(); @@ -1719,3 +1727,10 @@ void BenInputEditorWindow::DrawFullContents() { void BenInputEditorWindow::DrawElement() { DrawFullContents(); } + +void BenInputEditorWindow::OffsetMappingPopup() { + const float HORIZONTAL_OFFSET = 10.0f; + ImVec2 pos = ImGui::GetMousePos(); + pos.x += HORIZONTAL_OFFSET; + ImGui::SetNextWindowPos(pos); +} diff --git a/mm/2s2h/BenGui/BenInputEditorWindow.h b/mm/2s2h/BenGui/BenInputEditorWindow.h index 038a531085..9be8f11d06 100644 --- a/mm/2s2h/BenGui/BenInputEditorWindow.h +++ b/mm/2s2h/BenGui/BenInputEditorWindow.h @@ -87,4 +87,5 @@ class BenInputEditorWindow : public Ship::GuiWindow { std::map mDeviceIndexVisiblity; void DrawDeviceVisibilityButtons(); + void OffsetMappingPopup(); };