mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-26 08:37:08 +00:00
[lua] Fix Sprite:resize() function (resize sprite+images instead of just the canvas)
This commit is contained in:
parent
744bd36408
commit
5cb5ff9393
@ -38,6 +38,7 @@
|
|||||||
#include "app/transaction.h"
|
#include "app/transaction.h"
|
||||||
#include "app/tx.h"
|
#include "app/tx.h"
|
||||||
#include "app/ui/doc_view.h"
|
#include "app/ui/doc_view.h"
|
||||||
|
#include "base/convert_to.h"
|
||||||
#include "base/fs.h"
|
#include "base/fs.h"
|
||||||
#include "doc/frame_tag.h"
|
#include "doc/frame_tag.h"
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
@ -143,10 +144,18 @@ int Sprite_resize(lua_State* L)
|
|||||||
size.w = std::max(1, size.w);
|
size.w = std::max(1, size.w);
|
||||||
size.h = std::max(1, size.h);
|
size.h = std::max(1, size.h);
|
||||||
|
|
||||||
Doc* doc = static_cast<Doc*>(sprite->document());
|
Command* resizeCommand =
|
||||||
Tx tx;
|
Commands::instance()->byId(CommandId::SpriteSize());
|
||||||
DocApi(doc, tx).setSpriteSize(doc->sprite(), size.w, size.h);
|
|
||||||
tx.commit();
|
// TODO use SpriteSizeParams directly instead of converting back and
|
||||||
|
// forth between strings.
|
||||||
|
Params params;
|
||||||
|
params.set("ui", "false");
|
||||||
|
params.set("width", base::convert_to<std::string>(size.w).c_str());
|
||||||
|
params.set("height", base::convert_to<std::string>(size.h).c_str());
|
||||||
|
|
||||||
|
app::Context* appCtx = App::instance()->context();
|
||||||
|
appCtx->executeCommand(resizeCommand, params);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user