From fa091c048001d46e8642c74ff73ce96b3433cc91 Mon Sep 17 00:00:00 2001 From: RKrom Date: Thu, 24 Jan 2013 09:54:33 +0000 Subject: [PATCH] Added a fix for the cursor, it won't be on the surface if it's outside the captured range. This fixes the "issue" where the undo & delete buttons are active but nothing is visible. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2442 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- Greenshot/Drawing/Surface.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Greenshot/Drawing/Surface.cs b/Greenshot/Drawing/Surface.cs index 92a8380ad..524f5493b 100644 --- a/Greenshot/Drawing/Surface.cs +++ b/Greenshot/Drawing/Surface.cs @@ -416,13 +416,19 @@ namespace Greenshot.Drawing { /// /// public Surface(ICapture capture) : this(capture.Image) { + // check if cursor is captured, and visible + if (capture.Cursor != null && capture.CursorVisible) { + Rectangle cursorRect = new Rectangle(capture.CursorLocation, capture.Cursor.Size); + Rectangle captureRect = new Rectangle(Point.Empty, capture.Image.Size); + // check if cursor is on the capture, otherwise we leave it out. + if (cursorRect.IntersectsWith(captureRect)) { + cursorContainer = AddIconContainer(capture.Cursor, capture.CursorLocation.X, capture.CursorLocation.Y); + SelectElement(cursorContainer); + } + } // Make sure the image is NOT disposed, we took the reference directly into ourselves ((Capture)capture).NullImage(); - if (capture.Cursor != null && capture.CursorVisible) { - cursorContainer = AddIconContainer(capture.Cursor, capture.CursorLocation.X, capture.CursorLocation.Y); - SelectElement(cursorContainer); - } captureDetails = capture.CaptureDetails; }