Added an animation for the zoom area, this is just to show what we could do... might not be the final effect.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2319 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-11-27 08:07:01 +00:00
parent 4cb72219a5
commit 4efd779d86

View file

@ -71,6 +71,8 @@ namespace Greenshot.Forms {
private bool isZooming = true; private bool isZooming = true;
private Point previousMousePos = Point.Empty; private Point previousMousePos = Point.Empty;
private FixMode fixMode = FixMode.None; private FixMode fixMode = FixMode.None;
private Size zoomSize = new Size(20, 20);
private bool isAnimating = true;
/// <summary> /// <summary>
/// Property to access the selected capture rectangle /// Property to access the selected capture rectangle
@ -329,7 +331,7 @@ namespace Greenshot.Forms {
void updateFrame() { void updateFrame() {
Point lastPos = cursorPos.Clone(); Point lastPos = cursorPos.Clone();
cursorPos = mouseMovePos.Clone(); cursorPos = mouseMovePos.Clone();
if (lastPos.Equals(cursorPos)) { if (lastPos.Equals(cursorPos) && !isAnimating) {
return; return;
} }
@ -444,8 +446,14 @@ namespace Greenshot.Forms {
} }
} }
if (isZooming && captureMode != CaptureMode.Window) { if (isZooming && captureMode != CaptureMode.Window) {
Invalidate(ZoomArea(lastPos, new Size(200, 200))); Invalidate(ZoomArea(lastPos, zoomSize));
Invalidate(ZoomArea(cursorPos, new Size(200, 200))); if (zoomSize.Width < 200) {
zoomSize.Width += 10;
zoomSize.Height += 10;
} else {
isAnimating = false;
}
Invalidate(ZoomArea(cursorPos, zoomSize));
} }
// Force update "now" // Force update "now"
Update(); Update();
@ -671,7 +679,7 @@ namespace Greenshot.Forms {
const int zoomSourceHeight = 25; const int zoomSourceHeight = 25;
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);
DrawZoom(graphics, sourceRectangle, ZoomArea(cursorPos, new Size(200, 200))); DrawZoom(graphics, sourceRectangle, ZoomArea(cursorPos, zoomSize));
} }
} }