Make this check a bit more general purpose: in the case where the dragger is a child of the target view (probably the most common use case), we now verify that the dragger's frame is completely within the target, otherwise we reset it to a default position of the lower right corner. I'm not sure how to do similar validy checking in the case of the other relationships (or if that's even feasible) though. Comments welcome as always :)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28336 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
/*
|
||||
* Copyright 2001-2007, Haiku.
|
||||
* Copyright 2001-2008, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Marc Flerackers ([email protected])
|
||||
* Rene Gollent ([email protected])
|
||||
*/
|
||||
|
||||
//! BDragger represents a replicant "handle".
|
||||
@@ -595,9 +596,10 @@ BDragger::_DetermineRelationship()
|
||||
|
||||
if (fRelation == TARGET_IS_PARENT) {
|
||||
BRect bounds (Frame());
|
||||
if (bounds.left < 0 || bounds.top < 0)
|
||||
MoveTo(Parent()->Bounds().right - bounds.Width(),
|
||||
Parent()->Bounds().bottom - bounds.Height());
|
||||
BRect parentBounds (Parent()->Bounds());
|
||||
if (!parentBounds.Contains(bounds))
|
||||
MoveTo(parentBounds.right - bounds.Width(),
|
||||
parentBounds.bottom - bounds.Height());
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
|
||||
Reference in New Issue
Block a user