From 55f2e33b2df61abe243b75cf8b9e8bd2c1b63bc6 Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Fri, 12 Dec 2003 04:26:52 +0000 Subject: [PATCH] Changed Paste/DragDrop code so that a clip does not have to be pasted entirely within the bounds of the background bitmap git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5654 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/showimage/ShowImageView.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/apps/showimage/ShowImageView.cpp b/src/apps/showimage/ShowImageView.cpp index 259c6fa2b7..fa3023d323 100644 --- a/src/apps/showimage/ShowImageView.cpp +++ b/src/apps/showimage/ShowImageView.cpp @@ -1534,17 +1534,19 @@ ShowImageView::PasteBitmap(BBitmap *bitmap, BPoint point) { if (bitmap && bitmap->IsValid()) { MergeSelection(); - + SetHasSelection(true); fSelBitmap = bitmap; fCopyFromRect = BRect(); fSelectionRect = bitmap->Bounds(); - - if (fBitmap->Bounds().Contains(point)) - // Set the selection rectangle to the same location it was - // copied from, but only if the background bitmap is large enough - // to contain that point - fSelectionRect.OffsetBy(point); + + BRect offsetRect = fSelectionRect; + offsetRect.OffsetBy(point); + if (fBitmap->Bounds().Intersects(offsetRect)) + // Move the selection rectangle to desired origin, + // but only if the resulting selection rectangle + // intersects with the background bitmap rectangle + fSelectionRect = offsetRect; Invalidate(); }