From 4c4bbcb45181a5ac24591e3bb9c4210ce49dd76c Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 29 Jan 2015 15:04:49 +0100 Subject: [PATCH] Examples: fixed custom rendering example canvas size. --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index a5c5660a..a8b8d4b9 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8174,7 +8174,7 @@ static void ShowExampleAppCustomRendering(bool* opened) // However you can draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos(). // If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max) followed by an empty Text("") statement. ImVec2 canvas_pos = ImGui::GetCursorScreenPos(); // ImDrawList API uses screen coordinates! - ImVec2 canvas_size = ImVec2(ImMin(50.0f,ImGui::GetWindowContentRegionMax().x-ImGui::GetCursorPos().x), ImMin(50.0f,ImGui::GetWindowContentRegionMax().y-ImGui::GetCursorPos().y)); // Resize canvas what's available + ImVec2 canvas_size = ImVec2(ImMax(50.0f,ImGui::GetWindowContentRegionMax().x-ImGui::GetCursorPos().x), ImMax(50.0f,ImGui::GetWindowContentRegionMax().y-ImGui::GetCursorPos().y)); // Resize canvas what's available draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), 0xFFFFFFFF); bool adding_preview = false; ImGui::InvisibleButton("canvas", canvas_size);