diff --git a/graf/src/TPolyLine.cxx b/graf/src/TPolyLine.cxx
index 25c024db9fd6f1783519bcb5c83050923f00e3bd..157b5446230bc2031ce805702790706d74310bf0 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;
 }