summaryrefslogtreecommitdiff
path: root/src/imgui_ui_timeline.cpp
diff options
context:
space:
mode:
authorFox Caminiti <fox@foxcam.net>2023-03-05 13:29:14 -0500
committerFox Caminiti <fox@foxcam.net>2023-03-05 13:29:14 -0500
commitf7a194270e25deeb3ce9c9b9fbce0da8b6be71ca (patch)
tree3a9716248df5a2da58546e29c1b476c67500d621 /src/imgui_ui_timeline.cpp
parentd0410bddcd7ea43c51b6bf2442a99e58710e70eb (diff)
Diffstat (limited to 'src/imgui_ui_timeline.cpp')
-rw-r--r--src/imgui_ui_timeline.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/imgui_ui_timeline.cpp b/src/imgui_ui_timeline.cpp
index 8b8ca36..ab38bae 100644
--- a/src/imgui_ui_timeline.cpp
+++ b/src/imgui_ui_timeline.cpp
@@ -513,7 +513,7 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
Test &= (Layer_ScreenPos_Min.x <= io.MouseClickedPos[0].x && Layer_ScreenPos_Max.x >= io.MousePos.x);
if (Test) {
- if (!(Layer->IsSelected & 0x01) && !(Layer->IsSelected & 0x02) && !Layer->IsLocked) {
+ if (!(Layer->IsSelected & 0x01) && !(Layer->IsSelected & 0x02) && (!Layer->IsLocked || io.KeyCtrl)) {
Layer_Select(Memory, State, Index_Physical);
}
} else if (!io.KeyShift) {
@@ -599,15 +599,16 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
if (ImGui::MenuItem("Visible", NULL, Layer->IsVisible)) {
bool32 Commit = false;
int h = 0, z = 0, i = 0;
+ bool32 Val = Layer->IsVisible ^ 1;
while (Block_Loop(Memory, F_Layers, File->Layer_Count, &h, &z, &i)) {
- block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, i);
- if (Layer->IsSelected & 0x01) {
+ block_layer *CurLayer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, i);
+ if (CurLayer->IsVisible != Val && CurLayer->IsSelected & 0x01) {
if (!Commit) {
History_Entry_Commit(Memory, "Toggle visibility");
Commit = true;
}
- History_Action_Swap(Memory, F_Layers, sizeof(Layer->IsVisible), &Layer->IsVisible);
- Layer->IsVisible ^= 1;
+ History_Action_Swap(Memory, F_Layers, sizeof(CurLayer->IsVisible), &CurLayer->IsVisible);
+ CurLayer->IsVisible = Val;
}
}
if (Commit) {
@@ -618,15 +619,16 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
if (ImGui::MenuItem("Lock", NULL, Layer->IsLocked)) {
bool32 Commit = false;
int h = 0, z = 0, i = 0;
+ bool32 Val = Layer->IsLocked ^ 1;
while (Block_Loop(Memory, F_Layers, File->Layer_Count, &h, &z, &i)) {
block_layer *CurLayer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, i);
- if ((CurLayer->IsSelected & 0x01) || (Layer == CurLayer)) {
+ if (CurLayer->IsLocked != Val && ((CurLayer->IsSelected & 0x01) || (Layer == CurLayer))) {
if (!Commit) {
History_Entry_Commit(Memory, "Toggle lock");
Commit = true;
}
History_Action_Swap(Memory, F_Layers, sizeof(CurLayer->IsLocked), &CurLayer->IsLocked);
- CurLayer->IsLocked ^= 1;
+ CurLayer->IsLocked = Val;
}
}
if (Commit) {