From 83c18399a4c7f3c3628930b2cb4fc02f5e6e7669 Mon Sep 17 00:00:00 2001 From: Gaspar Capello Date: Wed, 22 Sep 2021 14:38:14 -0300 Subject: [PATCH] Fix incorrect cropping rectangle calculation in canvas size command in lua script Prior to this fix, CanvasSize command via lua script results in bad canvas and image clipping. --- src/app/commands/cmd_canvas_size.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/commands/cmd_canvas_size.cpp b/src/app/commands/cmd_canvas_size.cpp index 9351e1a6c..86bf3f8da 100644 --- a/src/app/commands/cmd_canvas_size.cpp +++ b/src/app/commands/cmd_canvas_size.cpp @@ -364,9 +364,14 @@ void CanvasSizeCommand::onExecute(Context* context) Preferences::instance().canvasSize.trimOutside(params.trimOutside()); - bounds.enlarge( - gfx::Border(params.left(), params.top(), - params.right(), params.bottom())); + if (params.bounds.isSet()) { + bounds = params.bounds(); + } + else { + bounds.enlarge( + gfx::Border(params.left(), params.top(), + params.right(), params.bottom())); + } } #endif