From 04b7ccfd87d802e6b9a22b86c8d098979164b8ba Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Mon, 15 Aug 2022 23:03:30 -0400 Subject: undo started --- my_imgui_widgets.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'my_imgui_widgets.cpp') diff --git a/my_imgui_widgets.cpp b/my_imgui_widgets.cpp index 4a4427c..d1d8d83 100644 --- a/my_imgui_widgets.cpp +++ b/my_imgui_widgets.cpp @@ -416,16 +416,19 @@ ImGui_Viewport(project_data File, project_state *State, ui *UI, comp_buffer Comp // The handle itself - draw_list->AddNgon(Point0_ScreenPos, 10, col, 8, 5.0f); + if (Point0->IsSelected) { + col = ImGui::GetColorU32(ImGuiCol_ButtonHovered); + draw_list->AddNgon(Point0_ScreenPos_Left, 10, col, 8, 5.0f); + draw_list->AddNgon(Point0_ScreenPos_Right, 10, col, 8, 5.0f); + draw_list->AddLine(Point0_ScreenPos, Point0_ScreenPos_Left, col, 2.0f); + draw_list->AddLine(Point0_ScreenPos, Point0_ScreenPos_Right, col, 2.0f); + } - draw_list->AddNgon(Point0_ScreenPos_Left, 10, col, 8, 5.0f); - draw_list->AddNgon(Point0_ScreenPos_Right, 10, col, 8, 5.0f); - draw_list->AddLine(Point0_ScreenPos, Point0_ScreenPos_Left, col, 2.0f); - draw_list->AddLine(Point0_ScreenPos, Point0_ScreenPos_Right, col, 2.0f); + draw_list->AddNgon(Point0_ScreenPos, 10, col, 8, 5.0f); int max = 1; - if (Point0->HandleBezier) { + if (Point0->HandleBezier && Point0->IsSelected) { max = 3; } @@ -440,11 +443,14 @@ ImGui_Viewport(project_data File, project_state *State, ui *UI, comp_buffer Comp ImGui::SetCursorScreenPos(Point0_ScreenPos_Right - ImVec2(PointSize/2, PointSize/2)); } - ImGui::Button("##point", ImVec2(PointSize, PointSize)); + ImGui::InvisibleButton("##point", ImVec2(PointSize, PointSize), ImGuiButtonFlags_MouseButtonLeft); if (ImGui::IsItemHovered()) { ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW); } + if (ImGui::IsItemActivated() && b == 0) { + Point0->IsSelected = 1; + } if (ImGui::IsItemActive()) { // TODO(fox): Combine this with the anchor point code. ImVec2 MouseIncrement = io.MouseDelta * (ImVec2(CompBuffer.Width, CompBuffer.Height) / UI->CompZoom); @@ -1258,7 +1264,7 @@ ImGui_Timeline(project_data *File, project_state *State, memory *Memory, ui *UI, // TODO(fox): Reformat this so it's all done in one loop. for (int b = 0; b < Property->NumberOfTotalKeyframes; b++) { - keyframe *Keyframe = KeyframeLookupIndex(Property, b); + keyframe *Keyframe = KeyframeLookupMemory(Property, b); real32 MinVal = Property->LocalMinVal.f; real32 MaxVal = Property->LocalMaxVal.f; @@ -1533,7 +1539,14 @@ ImGui_ProcessInputs(project_data *File, project_state *State, comp_buffer *CompB DeleteSelectedKeyframes(File, Memory); State->UpdateKeyframes = true; State->UpdateFrame = true; - } break; + } + case selection_maskpoint: + { + } + case selection_source: + { + } + break; } } -- cgit v1.2.3