mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-29 19:17:24 +01:00
Examples: Fixed crash when both buttons are held (#393)
This commit is contained in:
parent
1a42a3f91b
commit
6ffe0fddbf
@ -1734,7 +1734,7 @@ static void ShowExampleAppCustomRendering(bool* opened)
|
|||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered())
|
||||||
{
|
{
|
||||||
ImVec2 mouse_pos_in_canvas = ImVec2(ImGui::GetIO().MousePos.x - canvas_pos.x, ImGui::GetIO().MousePos.y - canvas_pos.y);
|
ImVec2 mouse_pos_in_canvas = ImVec2(ImGui::GetIO().MousePos.x - canvas_pos.x, ImGui::GetIO().MousePos.y - canvas_pos.y);
|
||||||
if (!adding_line && ImGui::GetIO().MouseClicked[0])
|
if (!adding_line && ImGui::IsMouseClicked(0))
|
||||||
{
|
{
|
||||||
points.push_back(mouse_pos_in_canvas);
|
points.push_back(mouse_pos_in_canvas);
|
||||||
adding_line = true;
|
adding_line = true;
|
||||||
@ -1746,9 +1746,9 @@ static void ShowExampleAppCustomRendering(bool* opened)
|
|||||||
if (!ImGui::GetIO().MouseDown[0])
|
if (!ImGui::GetIO().MouseDown[0])
|
||||||
adding_line = adding_preview = false;
|
adding_line = adding_preview = false;
|
||||||
}
|
}
|
||||||
if (ImGui::GetIO().MouseClicked[1] && !points.empty())
|
if (ImGui::IsMouseClicked(1) && !points.empty())
|
||||||
{
|
{
|
||||||
adding_line = false;
|
adding_line = adding_preview = false;
|
||||||
points.pop_back();
|
points.pop_back();
|
||||||
points.pop_back();
|
points.pop_back();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user