title: mouse coordinates to isometric coordinates
body: <p>I'm trying to get the right tile in the isometric world by mouse position.</p>
  
  <p>I've read some theads about this, but it doesn't seem to work for me. 
  The basic Idea is to recalculate the normal mouse coordinates to the isometric tile-coordinates. <img src="https://i.stack.imgur.com/upScA.jpg" alt="Isometric Map"></p>
  
  <p>As you can see the mouse cursor is at the tile 5/4 and the recalculation is wrong (the tile selected is 4/5). This is my Code:</p>
  
  <pre><code>var params.tx = 100, params.ty=54,
  PI = 3.14152,
  x1 = x_mouse - params.tx*5,
  y1 = y_mouse * -2,
  xr = Math.cos(PI/4)*x1 - Math.sin(PI/4)*y1,
  yr = Math.sin(PI/4)*x1 + Math.cos(PI/4)*y1,
  diag = (params.ty) * Math.sqrt(2),
  x2 = parseInt(xr / diag)+1, 
  y2 = parseInt(yr * -1 / diag)+1;
  </code></pre>
  
  <p>The original height of a tile is 54px, but as you can see, only the border tiles show their full height. The rest of the tiles are cut by 4 pixels.</p>
  
  <p>Please help me - may be my whole formula is wrong.</p>