title: Javascript: rect.contains(point)
body: <p>I like to see if mouseclick is in a rectangle area (in canvas).
  In C# i would do this.</p>
  
  <pre><code>var point = new Point(x, y);
  var rectangles = new List&lt;Rect&gt;();
  //rectangles.add(new Rect(x,y,h,w));
  foreach(var rectangle in rectangles)
  {
      if(rectangle.Contains(point))
      {
          //do something
      }
  }
  </code></pre>
  
  <p>In Javascript I Tried this</p>
  
  <pre><code>var c=document.getElementById("myCanvas");
  var ctx=c.getContext("2d");
  ctx.rect(20,20,150,100);
  if (ctx.isPointInPath(20,50))
     {
       //do something
     };
  </code></pre>
  
  <p>But there are more rectangles in the context then in my list rectangles. Can somebody help me out?</p>