Fix Cancel command do not work on scripting

Before this fix, the 'Cancel' command did not work in the following
specific situation:
As soon as Aseprite was started and without hitting the 'Esc' key,
the 'app.command.Cancel()' command did not perform any operation.

It was discovered that the Cancel command is started only once per
session and retains the 'm_type' throughout the session. Only
a specific:
app.command.Cancel {type = "all"} or
app.command.Cancel {type = "noop"}
could change the command type.
This commit is contained in:
Gaspar Capello 2024-08-29 09:57:17 -03:00 committed by David Capello
parent dd208ebe5d
commit 8323a55500

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2024 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -47,6 +48,8 @@ void CancelCommand::onLoadParams(const Params& params)
std::string type = params.get("type");
if (type == "noop") m_type = NoOp;
else if (type == "all") m_type = All;
// TODO: add specific types for selection/ranges during scripting.
else m_type = All;
}
void CancelCommand::onExecute(Context* context)