mirror of
https://github.com/greenshot/greenshot
synced 2025-07-30 19:50:11 -07:00
Fix weird scroll position when going from no scroll zoom value
Also prefer top left corner in that situation - it is less disorienting when working with screenshots.
This commit is contained in:
parent
99742ad05a
commit
464e5e872f
1 changed files with 11 additions and 2 deletions
|
@ -1581,10 +1581,19 @@ namespace Greenshot {
|
|||
}
|
||||
|
||||
// Store old scroll position
|
||||
// When no scroll is currently needed - prefer top left corner.
|
||||
var horizontalCenter = 0.0;
|
||||
var verticalCenter = 0.0;
|
||||
var rc = surface.GetVisibleRectangle();
|
||||
var size = surface.Size;
|
||||
var horizontalCenter = 1.0 * (rc.Left + rc.Width / 2) / size.Width;
|
||||
var verticalCenter = 1.0 * (rc.Top + rc.Height / 2) / size.Height;
|
||||
if (size.Width > rc.Width)
|
||||
{
|
||||
horizontalCenter = 1.0 * (rc.Left + rc.Width / 2) / size.Width;
|
||||
}
|
||||
if (size.Height > rc.Height)
|
||||
{
|
||||
verticalCenter = 1.0 * (rc.Top + rc.Height / 2) / size.Height;
|
||||
}
|
||||
|
||||
// Set the new zoom value
|
||||
_zoomValue = value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue