From 3cead3c68ef623b58cf5b50bfefd98306f9f3e73 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 26 Oct 2008 15:22:02 +0000 Subject: [PATCH] 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 --- src/kits/interface/Dragger.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kits/interface/Dragger.cpp b/src/kits/interface/Dragger.cpp index d1908b6dc4..a45c32aa69 100644 --- a/src/kits/interface/Dragger.cpp +++ b/src/kits/interface/Dragger.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2001-2007, Haiku. + * Copyright 2001-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: * Marc Flerackers (mflerackers@androme.be) + * Rene Gollent (rene@gollent.com) */ //! 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;