mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[sim] Fix Field2D GUI crash when collapsed (#2786)
Collapsed windows result in a vertical content size of 0.
This commit is contained in:
@@ -565,7 +565,10 @@ static void DisplayField2D() {
|
||||
|
||||
// for dragging to work, there needs to be a button (otherwise the window is
|
||||
// dragged)
|
||||
ImGui::InvisibleButton("field", ImGui::GetContentRegionAvail());
|
||||
ImVec2 contentSize =
|
||||
ImGui::GetWindowContentRegionMax() - ImGui::GetWindowContentRegionMin();
|
||||
if (contentSize.x <= 0 || contentSize.y <= 0) return;
|
||||
ImGui::InvisibleButton("field", contentSize);
|
||||
|
||||
// allow dragging the robot around
|
||||
ImVec2 cursor = ImGui::GetIO().MousePos - windowPos;
|
||||
|
||||
Reference in New Issue
Block a user