handling saving issues in certain contexts/new shortcuts

This commit is contained in:
2026-01-05 04:16:51 -05:00
parent a8143b6d0c
commit b41b6df19e
7 changed files with 87 additions and 22 deletions
+23 -2
View File
@@ -209,6 +209,7 @@ namespace anm2ed::imgui
if (ImGui::BeginChild("##Animations Child", childSize, ImGuiChildFlags_Borders))
{
selection.start(anm2.animations.items.size());
for (auto [i, animation] : std::views::enumerate(anm2.animations.items))
@@ -249,11 +250,17 @@ namespace anm2ed::imgui
if (isNewAnimation)
{
ImGui::SetScrollHereY(0.5f);
isUpdateScroll = true;
newAnimationSelectedIndex = -1;
}
ImGui::PopFont();
if (isUpdateScroll && isReferenced)
{
ImGui::SetScrollHereY(0.5f);
isUpdateScroll = false;
}
if (ImGui::BeginItemTooltip())
{
ImGui::PushFont(resources.fonts[font::BOLD].get(), font::SIZE);
@@ -468,5 +475,19 @@ namespace anm2ed::imgui
}
}
ImGui::End();
auto isNextAnimation = shortcut(manager.chords[SHORTCUT_NEXT_ANIMATION], shortcut::GLOBAL);
auto isPreviousAnimation = shortcut(manager.chords[SHORTCUT_PREVIOUS_ANIMATION], shortcut::GLOBAL);
if ((isPreviousAnimation || isNextAnimation) && !anm2.animations.items.empty())
{
if (isPreviousAnimation)
reference.animationIndex = glm::clamp(--reference.animationIndex, 0, (int)anm2.animations.items.size() - 1);
if (isNextAnimation)
reference.animationIndex = glm::clamp(++reference.animationIndex, 0, (int)anm2.animations.items.size() - 1);
selection = {reference.animationIndex};
isUpdateScroll = true;
}
}
}
}
+1
View File
@@ -14,6 +14,7 @@ namespace anm2ed::imgui
int newAnimationSelectedIndex{-1};
int renameQueued{-1};
bool isInContextMenu{};
bool isUpdateScroll{};
RenameState renameState{RENAME_SELECTABLE};
public:
+11 -11
View File
@@ -1866,21 +1866,21 @@ namespace anm2ed::imgui
}
isExtendChordHeld = isExtendFrame;
if (shortcut(manager.chords[SHORTCUT_PREVIOUS_FRAME], shortcut::GLOBAL))
{
if (auto item = document.item_get(); !item->frames.empty())
{
reference.frameIndex = glm::clamp(--reference.frameIndex, 0, (int)item->frames.size() - 1);
frames_selection_set_reference();
document.frameTime = item->frame_time_from_index_get(reference.frameIndex);
}
}
auto isPreviousFrame = shortcut(manager.chords[SHORTCUT_PREVIOUS_FRAME], shortcut::GLOBAL);
auto isNextFrame = shortcut(manager.chords[SHORTCUT_NEXT_FRAME], shortcut::GLOBAL);
if (shortcut(manager.chords[SHORTCUT_NEXT_FRAME], shortcut::GLOBAL))
if (isPreviousFrame)
if (auto item = document.item_get(); !item->frames.empty())
reference.frameIndex = glm::clamp(--reference.frameIndex, 0, (int)item->frames.size() - 1);
if (isNextFrame)
if (auto item = document.item_get(); !item->frames.empty())
reference.frameIndex = glm::clamp(++reference.frameIndex, 0, (int)item->frames.size() - 1);
if (isPreviousFrame || isNextFrame)
{
if (auto item = document.item_get(); !item->frames.empty())
{
reference.frameIndex = glm::clamp(++reference.frameIndex, 0, (int)item->frames.size() - 1);
frames_selection_set_reference();
document.frameTime = item->frame_time_from_index_get(reference.frameIndex);
}