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
This commit is contained in:
Matthew Wilber
2003-12-12 04:26:52 +00:00
parent 169c19d6f7
commit 55f2e33b2d
+9 -7
View File
@@ -1534,17 +1534,19 @@ ShowImageView::PasteBitmap(BBitmap *bitmap, BPoint point)
{ {
if (bitmap && bitmap->IsValid()) { if (bitmap && bitmap->IsValid()) {
MergeSelection(); MergeSelection();
SetHasSelection(true); SetHasSelection(true);
fSelBitmap = bitmap; fSelBitmap = bitmap;
fCopyFromRect = BRect(); fCopyFromRect = BRect();
fSelectionRect = bitmap->Bounds(); fSelectionRect = bitmap->Bounds();
if (fBitmap->Bounds().Contains(point)) BRect offsetRect = fSelectionRect;
// Set the selection rectangle to the same location it was offsetRect.OffsetBy(point);
// copied from, but only if the background bitmap is large enough if (fBitmap->Bounds().Intersects(offsetRect))
// to contain that point // Move the selection rectangle to desired origin,
fSelectionRect.OffsetBy(point); // but only if the resulting selection rectangle
// intersects with the background bitmap rectangle
fSelectionRect = offsetRect;
Invalidate(); Invalidate();
} }