From b07539cdf3bb8872171871355cc518a5f784fcdb Mon Sep 17 00:00:00 2001 From: Cameron White Date: Sat, 18 Jul 2020 10:28:50 -0400 Subject: [PATCH] Fix #1883623 where the canvas size could shrink in one dimension when pasting. --- CHANGELOG.md | 1 + Pinta.Core/Classes/Document.cs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b657ddc52..dbf2e0e02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Thanks to the following contributors who worked on this release: - Cairo blend operations are now used instead of PDN's managed blend modes (#98, [#1248933](https://bugs.launchpad.net/pinta/+bug/1248933), [#1091910](https://bugs.launchpad.net/pinta/+bug/1091910)). ### Fixed +- The option to expand the canvas when pasting an image now only changes the canvas size in the dimension where the pasted image is larger ([#1883623](https://bugs.launchpad.net/pinta/+bug/1883623)). - Fixed a bug where Auto Crop used the current layer instead of the entire image when deciding what to crop, and takes the selection into account ([#1434928](https://bugs.launchpad.net/pinta/+bug/1434928), [#1434906](https://bugs.launchpad.net/pinta/+bug/1434906)). - Fixed potential crashes when switching tools without any open documents ([#1425612](https://bugs.launchpad.net/pinta/+bug/1425612)). - Fixed a potential bug where the OK button in the New Image dialog could be incorrectly disabled ([#1430203](https://bugs.launchpad.net/pinta/+bug/1430203)). diff --git a/Pinta.Core/Classes/Document.cs b/Pinta.Core/Classes/Document.cs index f9d7d71dd..d48bbe420 100644 --- a/Pinta.Core/Classes/Document.cs +++ b/Pinta.Core/Classes/Document.cs @@ -828,9 +828,10 @@ public void Paste (bool toNewLayer, int x = 0, int y = 0) if (response == ResponseType.Accept) { - PintaCore.Workspace.ResizeCanvas (cbImage.Width, cbImage.Height, - Pinta.Core.Anchor.Center, paste_action); - PintaCore.Actions.View.UpdateCanvasScale (); + var new_width = Math.Max(canvas_size.Width, cbImage.Width); + var new_height = Math.Max(canvas_size.Height, cbImage.Height); + PintaCore.Workspace.ResizeCanvas(new_width, new_height, Pinta.Core.Anchor.Center, paste_action); + PintaCore.Actions.View.UpdateCanvasScale (); } else if (response == ResponseType.Cancel || response == ResponseType.DeleteEvent) {