Skip to content
Snippets Groups Projects
Commit 90608287 authored by Rene Brun's avatar Rene Brun
Browse files

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
parent b9ce03bf
No related branches found
No related tags found
No related merge requests found
// @(#)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 // Author: Rene Brun 12/12/94
/************************************************************************* /*************************************************************************
...@@ -151,6 +151,11 @@ Int_t TPolyLine::DistancetoPrimitive(Int_t px, Int_t py) ...@@ -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])); 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; 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; return distance;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment