talgalili / d3heatmap

A D3.js-based heatmap htmlwidget for R
Other
236 stars 95 forks source link

Wrong mouseover information shown when zoomed #63

Closed alanocallaghan closed 3 years ago

alanocallaghan commented 8 years ago

Easy fix: First, add browser checking: http://stackoverflow.com/questions/15159002/d3-js-browser-support In heatmapcore.js, define var current_origin before brush definition. In brush function, if resetting, set current_origin to [0,0]. Otherwise, set it to ex[0] (minima of brush extent).

Then, in mouseover labels, subtract appropriate values from row and column numbers, i.e., `

      var origin_col = current_origin[0];

      var col = Math.floor(x.invert(offsetX));

      if(isFirefox) col =  col - origin_col;

      var origin_row = current_origin[1];

      var row = Math.floor(y.invert(offsetY));

      if(isFirefox) row = row - origin_row;

`