mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Fixed a bug when cropping a large image which was scrolled, we didn't consider the scrolling offset.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2527 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
c2639a1bc7
commit
25c7e56c31
1 changed files with 14 additions and 15 deletions
|
@ -1281,24 +1281,23 @@ namespace Greenshot {
|
|||
return;
|
||||
}
|
||||
Size imageSize = this.Surface.Image.Size;
|
||||
Size currentImageClientSize = this.panel1.ClientSize;
|
||||
Size currentClientSize = this.panel1.ClientSize;
|
||||
var canvas = this.Surface as Control;
|
||||
if (currentImageClientSize.Width > imageSize.Width) {
|
||||
if (canvas != null) {
|
||||
canvas.Left = (currentImageClientSize.Width - imageSize.Width) / 2;
|
||||
}
|
||||
} else {
|
||||
if (canvas != null) {
|
||||
canvas.Left = 0;
|
||||
Panel panel = (Panel)canvas.Parent;
|
||||
int offsetX = -panel.HorizontalScroll.Value;
|
||||
int offsetY = -panel.VerticalScroll.Value;
|
||||
if (canvas != null) {
|
||||
if (currentClientSize.Width > imageSize.Width) {
|
||||
canvas.Left = offsetX + ((currentClientSize.Width - imageSize.Width) / 2);
|
||||
} else {
|
||||
canvas.Left = offsetX + 0;
|
||||
}
|
||||
}
|
||||
if (currentImageClientSize.Height > imageSize.Height) {
|
||||
if (canvas != null) {
|
||||
canvas.Top = (currentImageClientSize.Height - imageSize.Height) / 2;
|
||||
}
|
||||
} else {
|
||||
if (canvas != null) {
|
||||
canvas.Top = 0;
|
||||
if (canvas != null) {
|
||||
if (currentClientSize.Height > imageSize.Height) {
|
||||
canvas.Top = offsetY + ((currentClientSize.Height - imageSize.Height) / 2);
|
||||
} else {
|
||||
canvas.Top = offsetY + 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue