mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 15:11:05 +01:00 
			
		
		
		
	ColorEdit4: Can open context menu from inputs/drags as well (#346)
This commit is contained in:
		@@ -9205,6 +9205,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
 | 
			
		||||
                value_changed |= value_changed_as_float |= DragFloat(ids[n], &f[n], 1.0f/255.0f, 0.0f, 1.0f, fmt_table_float[fmt_idx][n]);
 | 
			
		||||
            else
 | 
			
		||||
                value_changed |= DragInt(ids[n], &i[n], 1.0f, 0, 255, fmt_table_int[fmt_idx][n]);
 | 
			
		||||
            if (!(flags & ImGuiColorEditFlags_NoOptions) && IsItemHovered() && IsMouseClicked(1))
 | 
			
		||||
                OpenPopup("context");
 | 
			
		||||
        }
 | 
			
		||||
        PopItemWidth();
 | 
			
		||||
        PopItemWidth();
 | 
			
		||||
@@ -9230,6 +9232,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
 | 
			
		||||
            else
 | 
			
		||||
                sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]);
 | 
			
		||||
        }
 | 
			
		||||
        if (!(flags & ImGuiColorEditFlags_NoOptions) && IsItemHovered() && IsMouseClicked(1))
 | 
			
		||||
            OpenPopup("context");
 | 
			
		||||
        PopItemWidth();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -9250,10 +9254,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
 | 
			
		||||
                SetNextWindowPos(window->DC.LastItemRect.GetBL() + ImVec2(-1,style.ItemSpacing.y));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else if (!(flags & ImGuiColorEditFlags_NoOptions) && IsItemHovered() && IsMouseClicked(1))
 | 
			
		||||
        {
 | 
			
		||||
        if (!(flags & ImGuiColorEditFlags_NoOptions) && IsItemHovered() && IsMouseClicked(1))
 | 
			
		||||
            OpenPopup("context");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (BeginPopup("picker"))
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user