From 90608287730eec2a07e6d1e667d16eb0397f10e5 Mon Sep 17 00:00:00 2001 From: Rene Brun <Rene.Brun@cern.ch> Date: Sun, 2 Nov 2003 10:32:17 +0000 Subject: [PATCH] Modify TPolyLine::DistancetoPrimitive to support the case of a filled and closed polyline. In this case the object is picked when the mouse is inside the polygone, otherwise the object is picked only when the mouse is closed to one of lines of the polyline. git-svn-id: http://root.cern.ch/svn/root/trunk@7510 27541ba8-7e3a-0410-8455-c3a389f83636 --- graf/src/TPolyLine.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/graf/src/TPolyLine.cxx b/graf/src/TPolyLine.cxx index 25c024db9fd..157b5446230 100644 --- a/graf/src/TPolyLine.cxx +++ b/graf/src/TPolyLine.cxx @@ -1,4 +1,4 @@ -// @(#)root/graf:$Name: $:$Id: TPolyLine.cxx,v 1.14 2002/10/31 07:27:35 brun Exp $ +// @(#)root/graf:$Name: $:$Id: TPolyLine.cxx,v 1.15 2002/11/05 16:09:15 brun Exp $ // Author: Rene Brun 12/12/94 /************************************************************************* @@ -151,6 +151,11 @@ Int_t TPolyLine::DistancetoPrimitive(Int_t px, Int_t py) d = DistancetoLine(px, py, gPad->XtoPad(fX[i]), gPad->YtoPad(fY[i]), gPad->XtoPad(fX[i+1]), gPad->YtoPad(fY[i+1])); if (d < distance) distance = d; } + +//*-*- in case of a closed and filled polyline, check if we are inside + if (fFillColor && fFillStyle && fX[0] == fX[fLastPoint] && fY[0] == fY[fLastPoint]) { + if (TMath::IsInside(gPad->AbsPixeltoX(px),gPad->AbsPixeltoY(py),fLastPoint+1,fX,fY)) distance = 0; + } return distance; } -- GitLab