mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 15:11:05 +01:00 
			
		
		
		
	ColorPicker: Comments. Single input value mode allow access to context-menu options. (#346)
This commit is contained in:
		
							
								
								
									
										18
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -551,7 +551,6 @@
 | 
			
		||||
 - tabs (#261, #351)
 | 
			
		||||
 - separator: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y)
 | 
			
		||||
!- color: the color helpers/typing is a mess and needs sorting out.
 | 
			
		||||
 - color: add a better color picker (#346)
 | 
			
		||||
 - node/graph editor (#306)
 | 
			
		||||
 - pie menus patterns (#434)
 | 
			
		||||
 - drag'n drop, dragging helpers (carry dragging info, visualize drag source before clicking, drop target, etc.) (#143, #479)
 | 
			
		||||
@@ -612,11 +611,11 @@
 | 
			
		||||
 - drawlist: end-user probably can't call Clear() directly because we expect a texture to be pushed in the stack.
 | 
			
		||||
 - examples: directx9: save/restore device state more thoroughly.
 | 
			
		||||
 - examples: window minimize, maximize (#583)
 | 
			
		||||
 - optimization: add clipping for multi-component widgets (SliderFloatX, ColorEditX, etc.). one problem is that nav branch can't easily clip parent group when there is a move request.
 | 
			
		||||
 - optimization: add a flag to disable most of rendering, for the case where the user expect to skip it (#335)
 | 
			
		||||
 - optimization: use another hash function than crc32, e.g. FNV1a
 | 
			
		||||
 - optimization/render: merge command-lists with same clip-rect into one even if they aren't sequential? (as long as in-between clip rectangle don't overlap)?
 | 
			
		||||
 - optimization: turn some the various stack vectors into statically-sized arrays
 | 
			
		||||
 - optimization: better clipping for multi-component widgets
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
 | 
			
		||||
@@ -9129,10 +9128,9 @@ bool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flag
 | 
			
		||||
    return ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Edit colors components (each component in 0.0f..1.0f range)
 | 
			
		||||
// Click on colored square to open a color picker (unless ImGuiColorEditFlags_NoPicker is set). Use CTRL-Click to input value and TAB to go to next item.
 | 
			
		||||
// Note: only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
 | 
			
		||||
// FIXME-OPT: Need to add coarse clipping for the entire widget.
 | 
			
		||||
// Edit colors components (each component in 0.0f..1.0f range). 
 | 
			
		||||
// See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
 | 
			
		||||
// With typical options: Left-click on colored square to open color picker. Right-click to open option menu. CTRL-Click over input fields to edit them and TAB to go to next item.
 | 
			
		||||
bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags)
 | 
			
		||||
{
 | 
			
		||||
    ImGuiWindow* window = GetCurrentWindow();
 | 
			
		||||
@@ -9406,11 +9404,13 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
 | 
			
		||||
    // R,G,B and H,S,V slider color editor
 | 
			
		||||
    if (!(flags & ImGuiColorEditFlags_NoInputs))
 | 
			
		||||
    {
 | 
			
		||||
        if ((flags & ImGuiColorEditFlags_ModeMask_) == 0)
 | 
			
		||||
            flags |= ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_HSV | ImGuiColorEditFlags_HEX;
 | 
			
		||||
        PushItemWidth((alpha_bar ? bar1_pos_x : bar0_pos_x) + bars_width - picker_pos.x);
 | 
			
		||||
        ImGuiColorEditFlags sub_flags_to_forward = ImGuiColorEditFlags_Float | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoColorSquare | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf;
 | 
			
		||||
        ImGuiColorEditFlags sub_flags = (flags & sub_flags_to_forward) | ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_NoOptions;
 | 
			
		||||
        ImGuiColorEditFlags sub_flags = (flags & sub_flags_to_forward) | ImGuiColorEditFlags_NoPicker;
 | 
			
		||||
        if ((flags & ImGuiColorEditFlags_ModeMask_) == 0)
 | 
			
		||||
            flags |= ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_HSV | ImGuiColorEditFlags_HEX;
 | 
			
		||||
        if ((flags & ImGuiColorEditFlags_ModeMask_) == ImGuiColorEditFlags_ModeMask_)
 | 
			
		||||
            sub_flags |= ImGuiColorEditFlags_NoOptions;
 | 
			
		||||
        if (flags & ImGuiColorEditFlags_RGB)
 | 
			
		||||
            value_changed |= ColorEdit4("##rgb", col, sub_flags | ImGuiColorEditFlags_RGB);
 | 
			
		||||
        if (flags & ImGuiColorEditFlags_HSV)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user