fixed issues with zoom positioning on multiscreen setup with negative screen coordinates

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2344 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
JKlingen 2012-12-02 16:21:27 +00:00
commit 05d9783a24

View file

@ -134,7 +134,7 @@ namespace Greenshot.Forms {
User32.ReleaseDC(hDCDesktop); User32.ReleaseDC(hDCDesktop);
LOG.DebugFormat("VRefresh {0}", vRefesh); LOG.DebugFormat("VRefresh {0}", vRefesh);
zoomAnimator = new RectangleAnimator(Rectangle.Empty, new Rectangle(zoomOffset, zoomSize), 20, EasingType.Quintic); zoomAnimator = new RectangleAnimator(Rectangle.Empty, new Rectangle(zoomOffset, zoomSize), 20, EasingType.Quintic, EasingMode.EaseOut);
// comment this out if the timer should not be used // comment this out if the timer should not be used
timer = new Timer(); timer = new Timer();
@ -492,11 +492,11 @@ namespace Greenshot.Forms {
} }
if (isZooming && captureMode != CaptureMode.Window) { if (isZooming && captureMode != CaptureMode.Window) {
Rectangle zoomArea = zoomAnimator.Current; Rectangle zoomArea = zoomAnimator.Current;
zoomArea.Offset(lastPos); zoomArea.Offset(lastPosOnBitmap);
Invalidate(zoomArea); Invalidate(zoomArea);
zoomArea = AnimateZoomArea(cursorPos); zoomArea = AnimateZoomArea(cursorPosOnBitmap);
zoomArea.Offset(cursorPos); zoomArea.Offset(cursorPosOnBitmap);
Invalidate(zoomArea); Invalidate(zoomArea);
} }
// Force update "now" // Force update "now"
@ -526,16 +526,16 @@ namespace Greenshot.Forms {
/// Change direction if not. /// Change direction if not.
/// </summary> /// </summary>
private Rectangle AnimateZoomArea(Point pos) { private Rectangle AnimateZoomArea(Point pos) {
Rectangle ret;
Rectangle screenBounds = Screen.GetBounds(MousePosition); Rectangle screenBounds = Screen.GetBounds(MousePosition);
Rectangle targetRectangle = zoomAnimator.Last; Rectangle targetRectangle = zoomAnimator.Last;
targetRectangle.Offset(pos); targetRectangle.Offset(pos);
screenBounds.Location = GetAbsoluteLocation(screenBounds.Location);
if (screenBounds.Contains(targetRectangle)) { if (screenBounds.Contains(targetRectangle)) {
// All okay // All okay
return zoomAnimator.Next(); ret = zoomAnimator.Next();
} } else {
Point destinationLocation; Point destinationLocation;
Rectangle tl = new Rectangle(pos.X - (zoomOffset.X + zoomSize.Width), pos.Y - (zoomOffset.Y + zoomSize.Height), zoomSize.Width, zoomSize.Height); Rectangle tl = new Rectangle(pos.X - (zoomOffset.X + zoomSize.Width), pos.Y - (zoomOffset.Y + zoomSize.Height), zoomSize.Width, zoomSize.Height);
Rectangle tr = new Rectangle(pos.X + zoomOffset.X, pos.Y - (zoomOffset.Y + zoomSize.Height), zoomSize.Width, zoomSize.Height); Rectangle tr = new Rectangle(pos.X + zoomOffset.X, pos.Y - (zoomOffset.Y + zoomSize.Height), zoomSize.Width, zoomSize.Height);
@ -552,7 +552,9 @@ namespace Greenshot.Forms {
} }
zoomAnimator.ChangeDestination(new Rectangle(new Point(-10, -10), new Size(20, 20))); zoomAnimator.ChangeDestination(new Rectangle(new Point(-10, -10), new Size(20, 20)));
zoomAnimator.QueueDestination(new Rectangle(destinationLocation, zoomSize)); zoomAnimator.QueueDestination(new Rectangle(destinationLocation, zoomSize));
return zoomAnimator.Next(); ret = zoomAnimator.Next();
}
return ret;
} }
/// <summary> /// <summary>
@ -789,7 +791,7 @@ namespace Greenshot.Forms {
Rectangle sourceRectangle = new Rectangle(cursorPosOnBitmap.X - (zoomSourceWidth / 2), cursorPosOnBitmap.Y - (zoomSourceHeight / 2), zoomSourceWidth, zoomSourceHeight); Rectangle sourceRectangle = new Rectangle(cursorPosOnBitmap.X - (zoomSourceWidth / 2), cursorPosOnBitmap.Y - (zoomSourceHeight / 2), zoomSourceWidth, zoomSourceHeight);
Rectangle destinationRectangle = zoomAnimator.Current; Rectangle destinationRectangle = zoomAnimator.Current;
destinationRectangle.Offset(cursorPos); destinationRectangle.Offset(cursorPosOnBitmap);
DrawZoom(graphics, sourceRectangle, destinationRectangle); DrawZoom(graphics, sourceRectangle, destinationRectangle);
} }