quck fixes to issues i noticed while doing a general overview

This commit is contained in:
2025-11-14 16:22:22 -05:00
parent 5470368b6a
commit 4b6fa7153d
5 changed files with 13 additions and 8 deletions

View File

@@ -175,7 +175,6 @@ namespace anm2ed::imgui
{ {
if (!manager.anm2DragDropPopup.is_open()) manager.anm2DragDropPopup.open(); if (!manager.anm2DragDropPopup.is_open()) manager.anm2DragDropPopup.open();
bool wasOpen = manager.anm2DragDropPopup.is_open();
manager.anm2DragDropPopup.trigger(); manager.anm2DragDropPopup.trigger();
if (ImGui::BeginPopupContextWindow(manager.anm2DragDropPopup.label, ImGuiPopupFlags_None)) if (ImGui::BeginPopupContextWindow(manager.anm2DragDropPopup.label, ImGuiPopupFlags_None))
@@ -212,7 +211,7 @@ namespace anm2ed::imgui
manager.anm2DragDropPopup.end(); manager.anm2DragDropPopup.end();
ImGui::EndPopup(); ImGui::EndPopup();
} }
else if (wasOpen && !manager.anm2DragDropPopup.is_open()) else if (!ImGui::IsPopupOpen(manager.anm2DragDropPopup.label))
drag_drop_reset(); drag_drop_reset();
} }
} }

View File

@@ -909,8 +909,10 @@ namespace anm2ed::imgui
if (shortcut(manager.chords[SHORTCUT_OPEN], shortcut::GLOBAL)) dialog.file_open(dialog::ANM2_OPEN); if (shortcut(manager.chords[SHORTCUT_OPEN], shortcut::GLOBAL)) dialog.file_open(dialog::ANM2_OPEN);
if (shortcut(manager.chords[SHORTCUT_SAVE], shortcut::GLOBAL)) if (shortcut(manager.chords[SHORTCUT_SAVE], shortcut::GLOBAL))
{ {
if (settings.fileIsWarnOverwrite) overwritePopup.open(); if (settings.fileIsWarnOverwrite)
manager.save(); overwritePopup.open();
else
manager.save();
} }
if (shortcut(manager.chords[SHORTCUT_SAVE_AS], shortcut::GLOBAL)) dialog.file_save(dialog::ANM2_SAVE); if (shortcut(manager.chords[SHORTCUT_SAVE_AS], shortcut::GLOBAL)) dialog.file_save(dialog::ANM2_SAVE);
if (shortcut(manager.chords[SHORTCUT_EXIT], shortcut::GLOBAL)) isQuitting = true; if (shortcut(manager.chords[SHORTCUT_EXIT], shortcut::GLOBAL)) isQuitting = true;

View File

@@ -363,8 +363,10 @@ namespace anm2ed::imgui
if (!isOnlyShowLayers && root.isVisible && animation->rootAnimation.isVisible) if (!isOnlyShowLayers && root.isVisible && animation->rootAnimation.isVisible)
{ {
auto rootTransform = baseTransform * math::quad_model_get(TARGET_SIZE, root.position, TARGET_SIZE * 0.5f, auto rootTransform =
math::percent_to_unit(root.scale), root.rotation); isRootTransform ? baseTransform * math::quad_model_get(TARGET_SIZE, root.position, TARGET_SIZE * 0.5f,
math::percent_to_unit(root.scale), root.rotation)
: baseTransform * math::quad_model_get(TARGET_SIZE, {}, TARGET_SIZE * 0.5f);
vec4 color = isOnionskin ? vec4(colorOffset, alphaOffset) : color::GREEN; vec4 color = isOnionskin ? vec4(colorOffset, alphaOffset) : color::GREEN;

View File

@@ -1,7 +1,6 @@
#include "timeline.h" #include "timeline.h"
#include <algorithm> #include <algorithm>
#include <cstddef>
#include <imgui_internal.h> #include <imgui_internal.h>

View File

@@ -34,6 +34,7 @@ namespace anm2ed
void State::update(SDL_Window*& window, Settings& settings) void State::update(SDL_Window*& window, Settings& settings)
{ {
SDL_Event event{}; SDL_Event event{};
bool openDroppedDocumentsImmediately = manager.documents.empty();
while (SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
{ {
@@ -46,8 +47,10 @@ namespace anm2ed
if (filesystem::path_is_extension(droppedFile, "anm2")) if (filesystem::path_is_extension(droppedFile, "anm2"))
{ {
std::filesystem::path droppedPath{droppedFile}; std::filesystem::path droppedPath{droppedFile};
if (manager.documents.empty()) if (openDroppedDocumentsImmediately)
{
manager.open(droppedPath); manager.open(droppedPath);
}
else else
{ {
if (std::find(manager.anm2DragDropPaths.begin(), manager.anm2DragDropPaths.end(), droppedPath) == if (std::find(manager.anm2DragDropPaths.begin(), manager.anm2DragDropPaths.end(), droppedPath) ==