mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	ImRect::Clip() -> ClipWith() to clarify meaning, going to undo the change in Nav branch.
This commit is contained in:
		| @@ -3103,7 +3103,7 @@ bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool c | |||||||
|     // Clip |     // Clip | ||||||
|     ImRect rect_clipped(r_min, r_max); |     ImRect rect_clipped(r_min, r_max); | ||||||
|     if (clip) |     if (clip) | ||||||
|         rect_clipped.Clip(window->ClipRect); |         rect_clipped.ClipWith(window->ClipRect); | ||||||
|  |  | ||||||
|     // Expand for touch input |     // Expand for touch input | ||||||
|     const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding); |     const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding); | ||||||
| @@ -4390,7 +4390,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us | |||||||
|  |  | ||||||
|         // Save clipped aabb so we can access it in constant-time in FindHoveredWindow() |         // Save clipped aabb so we can access it in constant-time in FindHoveredWindow() | ||||||
|         window->WindowRectClipped = window->Rect(); |         window->WindowRectClipped = window->Rect(); | ||||||
|         window->WindowRectClipped.Clip(window->ClipRect); |         window->WindowRectClipped.ClipWith(window->ClipRect); | ||||||
|  |  | ||||||
|         // Pressing CTRL+C while holding on a window copy its content to the clipboard |         // Pressing CTRL+C while holding on a window copy its content to the clipboard | ||||||
|         // This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope. |         // This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope. | ||||||
| @@ -8213,7 +8213,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 | |||||||
|                     ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true); |                     ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true); | ||||||
|                     if (rect_size.x <= 0.0f) rect_size.x = (float)(int)(g.Font->GetCharAdvance((unsigned short)' ') * 0.50f); // So we can see selected empty lines |                     if (rect_size.x <= 0.0f) rect_size.x = (float)(int)(g.Font->GetCharAdvance((unsigned short)' ') * 0.50f); // So we can see selected empty lines | ||||||
|                     ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos +ImVec2(rect_size.x, bg_offy_dn)); |                     ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos +ImVec2(rect_size.x, bg_offy_dn)); | ||||||
|                     rect.Clip(clip_rect); |                     rect.ClipWith(clip_rect); | ||||||
|                     if (rect.Overlaps(clip_rect)) |                     if (rect.Overlaps(clip_rect)) | ||||||
|                         draw_window->DrawList->AddRectFilled(rect.Min, rect.Max, bg_color); |                         draw_window->DrawList->AddRectFilled(rect.Min, rect.Max, bg_color); | ||||||
|                 } |                 } | ||||||
| @@ -10075,7 +10075,7 @@ void ImGui::BeginColumns(const char* id, int columns_count, ImGuiColumnsFlags fl | |||||||
|         float clip_x1 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(column_index) - 1.0f); |         float clip_x1 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(column_index) - 1.0f); | ||||||
|         float clip_x2 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(column_index + 1) - 1.0f); |         float clip_x2 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(column_index + 1) - 1.0f); | ||||||
|         window->DC.ColumnsData[column_index].ClipRect = ImRect(clip_x1, -FLT_MAX, clip_x2, +FLT_MAX); |         window->DC.ColumnsData[column_index].ClipRect = ImRect(clip_x1, -FLT_MAX, clip_x2, +FLT_MAX); | ||||||
|         window->DC.ColumnsData[column_index].ClipRect.Clip(window->ClipRect); |         window->DC.ColumnsData[column_index].ClipRect.ClipWith(window->ClipRect); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     window->DrawList->ChannelsSplit(window->DC.ColumnsCount); |     window->DrawList->ChannelsSplit(window->DC.ColumnsCount); | ||||||
|   | |||||||
| @@ -267,7 +267,7 @@ struct IMGUI_API ImRect | |||||||
|     void        Expand(const float amount)      { Min.x -= amount;   Min.y -= amount;   Max.x += amount;   Max.y += amount; } |     void        Expand(const float amount)      { Min.x -= amount;   Min.y -= amount;   Max.x += amount;   Max.y += amount; } | ||||||
|     void        Expand(const ImVec2& amount)    { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; } |     void        Expand(const ImVec2& amount)    { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; } | ||||||
|     void        Reduce(const ImVec2& amount)    { Min.x += amount.x; Min.y += amount.y; Max.x -= amount.x; Max.y -= amount.y; } |     void        Reduce(const ImVec2& amount)    { Min.x += amount.x; Min.y += amount.y; Max.x -= amount.x; Max.y -= amount.y; } | ||||||
|     void        Clip(const ImRect& clip)        { if (Min.x < clip.Min.x) Min.x = clip.Min.x; if (Min.y < clip.Min.y) Min.y = clip.Min.y; if (Max.x > clip.Max.x) Max.x = clip.Max.x; if (Max.y > clip.Max.y) Max.y = clip.Max.y; } |     void        ClipWith(const ImRect& clip)    { if (Min.x < clip.Min.x) Min.x = clip.Min.x; if (Min.y < clip.Min.y) Min.y = clip.Min.y; if (Max.x > clip.Max.x) Max.x = clip.Max.x; if (Max.y > clip.Max.y) Max.y = clip.Max.y; } | ||||||
|     void        Floor()                         { Min.x = (float)(int)Min.x; Min.y = (float)(int)Min.y; Max.x = (float)(int)Max.x; Max.y = (float)(int)Max.y; } |     void        Floor()                         { Min.x = (float)(int)Min.x; Min.y = (float)(int)Min.y; Max.x = (float)(int)Max.x; Max.y = (float)(int)Max.y; } | ||||||
|     ImVec2      GetClosestPoint(ImVec2 p, bool on_edge) const |     ImVec2      GetClosestPoint(ImVec2 p, bool on_edge) const | ||||||
|     { |     { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user