From 5f4964f367e8df0b5268a9f921805deadc7a67c7 Mon Sep 17 00:00:00 2001 From: ffiirree Date: Thu, 25 May 2023 00:50:37 +0800 Subject: [PATCH] fix a bug while deleting graphs --- CMakeLists.txt | 2 +- src/core/canvas.cpp | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5ad437..70025d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ add_subdirectory(3rdparty/fmt EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/probe EXCLUDE_FROM_ALL) # Windows SDK >= 10.0.22621.0 -if (WIN32 AND ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} VERSION_LESS "10.0.22621.0") +if (WIN32 AND "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}" VERSION_LESS "10.0.22621.0") message(FATAL_ERROR "Capturer requires Windows SDK 10.0.22621.0 and above to compile.") endif() diff --git a/src/core/canvas.cpp b/src/core/canvas.cpp index ee49f2c..a8caee2 100644 --- a/src/core/canvas.cpp +++ b/src/core/canvas.cpp @@ -409,10 +409,18 @@ void Canvas::paste() void Canvas::remove() { if (enabled_ && focus_cmd_) { - HIDE_AND_COPY_CMD(focus_cmd_); - commands_.push(focus_cmd_); - redo_stack_.clear(); - focusOn(nullptr); + // focus is not pseudo, then create one + if (!focus_cmd_->previous()) { + HIDE_AND_COPY_CMD(focus_cmd_); + } + + focus_cmd_->visible(false); + + // not editing (not goto mouse release event handler) + if (!(edit_status_ & OPERATION_MASK)) { + commands_.push(focus_cmd_); + redo_stack_.clear(); + } } }