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()) {
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();
}