mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-11-04 09:44:29 +00:00 
			
		
		
		
	Close button submitted after collapse button. Should have no effect. Consistent with expectation & will be used as fallback for nav (#323)
This commit is contained in:
		
							
								
								
									
										18
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -5088,15 +5088,6 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
 | 
				
			|||||||
                window->DC.ItemFlags &= ~ImGuiItemFlags_AllowNavDefaultFocus;
 | 
					                window->DC.ItemFlags &= ~ImGuiItemFlags_AllowNavDefaultFocus;
 | 
				
			||||||
            window->DC.NavLayerCurrent++;
 | 
					            window->DC.NavLayerCurrent++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Close button
 | 
					 | 
				
			||||||
            if (p_open != NULL)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                const float PAD = 2.0f;
 | 
					 | 
				
			||||||
                const float rad = (window->TitleBarHeight() - PAD*2.0f) * 0.5f;
 | 
					 | 
				
			||||||
                if (CloseButton(window->GetID("#CLOSE"), window->Rect().GetTR() + ImVec2(-PAD - rad, PAD + rad), rad))
 | 
					 | 
				
			||||||
                    *p_open = false;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // Collapse button
 | 
					            // Collapse button
 | 
				
			||||||
            const ImVec2 text_size = CalcTextSize(name, NULL, true);
 | 
					            const ImVec2 text_size = CalcTextSize(name, NULL, true);
 | 
				
			||||||
            if (!(flags & ImGuiWindowFlags_NoCollapse))
 | 
					            if (!(flags & ImGuiWindowFlags_NoCollapse))
 | 
				
			||||||
@@ -5110,6 +5101,15 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
 | 
				
			|||||||
                RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f, true);
 | 
					                RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f, true);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Close button
 | 
				
			||||||
 | 
					            if (p_open != NULL)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                const float PAD = 2.0f;
 | 
				
			||||||
 | 
					                const float rad = (window->TitleBarHeight() - PAD*2.0f) * 0.5f;
 | 
				
			||||||
 | 
					                if (CloseButton(window->GetID("#CLOSE"), window->Rect().GetTR() + ImVec2(-PAD - rad, PAD + rad), rad))
 | 
				
			||||||
 | 
					                    *p_open = false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            window->DC.NavLayerCurrent--;
 | 
					            window->DC.NavLayerCurrent--;
 | 
				
			||||||
            window->DC.ItemFlags = backup_item_options;
 | 
					            window->DC.ItemFlags = backup_item_options;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user