summaryrefslogtreecommitdiff
path: root/src/imgui_ui_viewport.cpp
diff options
context:
space:
mode:
authorFox Caminiti <fox@foxcam.net>2023-02-07 00:21:06 -0500
committerFox Caminiti <fox@foxcam.net>2023-02-07 00:21:06 -0500
commitee654e9217487f6fca12356ec8af82319c309592 (patch)
tree7b87b83ed9087b73b733555243a66d3d0c93e900 /src/imgui_ui_viewport.cpp
parente2e0e630ca51a4fd80a8186c5795c96693a2815b (diff)
good changes
Diffstat (limited to 'src/imgui_ui_viewport.cpp')
-rw-r--r--src/imgui_ui_viewport.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/imgui_ui_viewport.cpp b/src/imgui_ui_viewport.cpp
index 946edec..2489cd5 100644
--- a/src/imgui_ui_viewport.cpp
+++ b/src/imgui_ui_viewport.cpp
@@ -279,11 +279,11 @@ T_FindBestFit(int PointCount, v2 *PointData, v2 *Center, v2 *NewCenter, v2 *Best
int a = 0;
return 0;
}
+
static void
LayerIterate(project_state *State, memory *Memory, uint32 CompIndex, layer_transforms ExtraT, v2 Center,
sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray);
-
static void
ImGui_Viewport_TransformUI2(project_data *File, project_state *State, memory *Memory, ui *UI, ImGuiIO &io, ImDrawList *draw_list,
int *PointCount, v2 *PointData, ImVec2 ViewportMin, uint32 CompWidth, uint32 CompHeight,
@@ -653,12 +653,20 @@ ImGui_Viewport_TransformUI2(project_data *File, project_state *State, memory *Me
}
layer_transforms T = {};
+ T.scale = 1.0f;
LayerIterate(State, Memory, File->PrincipalCompIndex, T, Center, SortedCompArray, SortedLayerArray);
History_Entry_End(Memory);
State->UpdateFrame = true;
State->UncommitedKeyframe = 1;
} else {
- int32 Selection = Layer_TestSelection(Memory, State, UI, SortedCompArray, SortedLayerArray, File->PrincipalCompIndex, io.KeyShift);
+ // int32 Selection = Layer_TestSelection(Memory, State, UI, SortedCompArray, SortedLayerArray, File->PrincipalCompIndex, io.KeyShift);
+ layer_transforms T = {};
+ T.scale = 1.0f;
+
+ v2 CompPoint = ImGui_ScreenPointToCompUV(ViewportMin, UI->CompPos, UI->CompZoom, io.MousePos) * V2(CompWidth, CompHeight);
+ int32 Selection = LayerIterate_TestSelection(State, Memory, File->PrincipalCompIndex, T, CompPoint,
+ SortedCompArray, SortedLayerArray, io.KeyShift);
+
Assert(State->Tool == tool_default);
if (!io.KeyShift) {
Layer_DeselectAll(File, State, Memory);
@@ -1258,7 +1266,11 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory,
BoxMax.y = (MousePos.y > ClickedPos.y) ? MousePos.y : ClickedPos.y;
if (io.MouseDelta.x || io.MouseDelta.y) {
if (State->Tool == tool_default && State->Interact_Active == interact_type_none) {
- int32 Selection = Layer_TestSelection(Memory, State, UI, SortedCompArray, SortedLayerArray, File->PrincipalCompIndex, io.KeyShift);
+ layer_transforms T = {};
+ T.scale = 1.0f;
+ v2 CompPoint = ImGui_ScreenPointToCompUV(ViewportMin, UI->CompPos, UI->CompZoom, io.MousePos) * V2(MainComp->Width, MainComp->Height);
+ int32 Selection = LayerIterate_TestSelection(State, Memory, File->PrincipalCompIndex, T, CompPoint,
+ SortedCompArray, SortedLayerArray, io.KeyShift);
if (!State->InteractTransformMode && Selection != -1) {
if (!io.KeyShift)
Layer_DeselectAll(File, State, Memory);
@@ -1296,7 +1308,11 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory,
State->Interact_OutOfDrag = 0;
} else {
// Layer selection
- int32 Selection = Layer_TestSelection(Memory, State, UI, SortedCompArray, SortedLayerArray, File->PrincipalCompIndex, io.KeyShift);
+ layer_transforms T = {};
+ T.scale = 1.0f;
+ v2 CompPoint = ImGui_ScreenPointToCompUV(ViewportMin, UI->CompPos, UI->CompZoom, io.MousePos) * V2(MainComp->Width, MainComp->Height);
+ int32 Selection = LayerIterate_TestSelection(State, Memory, File->PrincipalCompIndex, T, CompPoint,
+ SortedCompArray, SortedLayerArray, io.KeyShift);
if (State->Tool == tool_default && State->Interact_Active == interact_type_none) {
if (!io.KeyShift && State->Interact_Active == interact_type_none) {
Layer_DeselectAll(File, State, Memory);