diff options
author | Fox Caminiti <fox@foxcam.net> | 2023-01-23 23:57:37 -0500 |
---|---|---|
committer | Fox Caminiti <fox@foxcam.net> | 2023-01-23 23:57:37 -0500 |
commit | e4acc91f56d9d88b75f60a23bd9662804d7c54b7 (patch) | |
tree | e0a30356d078557cf18417082dc0122c6fd4c171 /src/prenderer.cpp | |
parent | 6298837d4b5fbff561e3d7e6a3361bd64e432960 (diff) |
selection upgrade wip
Diffstat (limited to 'src/prenderer.cpp')
-rw-r--r-- | src/prenderer.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/prenderer.cpp b/src/prenderer.cpp index 08cdadf..1cc490c 100644 --- a/src/prenderer.cpp +++ b/src/prenderer.cpp @@ -83,7 +83,8 @@ Transform_ApplyInteractive(interact_transform Interact, real32 *OutputX, real32 *OutputX = X0 + Interact.Position.x; *OutputY = Y0 + Interact.Position.y; *OutputRotation += Rotation; - *OutputScale += Interact.Scale - 1.0f; + // *OutputScale += Interact.Scale - 1.0f; + *OutputScale *= Interact.Scale; } static void @@ -222,6 +223,30 @@ Interact_Transform_Begin(project_data *File, memory *Memory, project_state *Stat */ } +static void +Interact_Transform2_Begin(project_data *File, memory *Memory, project_state *State, ImVec2 OGPos, + sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray) +{ + real32 MinX = 100000; + real32 MinY = 100000; + real32 MaxX = -100000; + real32 MaxY = -100000; + block_composition *MainComp = (block_composition *)Memory_Block_AddressAtIndex(Memory, F_Precomps, File->PrincipalCompIndex); + block_layer *ParentLayer[4]; + Transform_Recurse(State, Memory, MainComp, File->PrincipalCompIndex, ParentLayer, 0, + SortedCompArray, SortedLayerArray, + &MinX, &MinY, &MaxX, &MaxY); + if (MinX != 100000) { + State->Interact_Active = interact_type_viewport_transform; + interact_transform *Interact = (interact_transform *)&State->Interact_Offset[0]; + Interact->Min = V2(MinX, MinY); + Interact->Max = V2(MaxX, MaxY); + Interact->Position = V2(0); + Interact->Radians = 0; + Interact->Scale = 1.0f; + Interact->OGPos = OGPos; + } +} static v2 TransformPoint(layer_transforms T, real32 Width, real32 Height, v2 Point) @@ -263,7 +288,8 @@ Layer_LocalToScreenSpace(project_state *State, memory *Memory, block_layer *Laye layer_transforms T = Layer_GetTransforms(Layer); - if (State->Interact_Active == interact_type_viewport_transform && Layer->IsSelected == 1) { + if ((State->Interact_Active == interact_type_viewport_transform || + State->Interact_Active == interact_type_viewport_transform_gizmo) && Layer->IsSelected == 1) { Transform_ApplyInteractive(*(interact_transform *)&State->Interact_Offset[0], &T.x, &T.y, &T.rotation, &T.scale); } @@ -364,7 +390,8 @@ Transform_Calculate(project_state *State, memory *Memory, project_data *File, bl real32 s = Layer->scale.CurrentValue; blend_mode BlendMode = Layer->BlendMode; - if (State->Interact_Active == interact_type_viewport_transform && Layer->IsSelected == 1) { + if ((State->Interact_Active == interact_type_viewport_transform || + State->Interact_Active == interact_type_viewport_transform_gizmo) && Layer->IsSelected == 1) { Transform_ApplyInteractive(*(interact_transform *)&State->Interact_Offset[0], &X, &Y, &Rotation, &s); } |