canvas-heatmap
Advanced tools
Comparing version 1.5.0 to 1.5.1
{ | ||
"name": "canvas-heatmap", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Interactive heatmap, capable of displaying 1,000,000+ data points using canvas and d3. ", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -792,2 +792,23 @@ import { | ||
zoombox.on("click", (event) => { | ||
try { | ||
var hoverX = xAxis.ax.invert( | ||
event.layerX - options.marginLeft || event.offsetX - options.marginLeft | ||
); | ||
var hoverY = yAxis.ax.invert( | ||
event.layerY - options.marginTop || event.offsetY - options.marginTop | ||
); | ||
var idx = Math.max( | ||
getFileIndex(xFileDomain, hoverX), | ||
getFileIndex(yFileDomain, hoverY) | ||
); | ||
var process = data[idx]; | ||
var yi = closest(hoverY, process.y); | ||
var xi = closest(hoverX, process.x); | ||
if (options.click) options.click({ mousex: xi, mousey: yi, idx }); | ||
} catch (e) { | ||
if (options.click) options.click({ mousex: false, mousey: false }); | ||
} | ||
}); | ||
zoombox.on("mouseout", () => { | ||
@@ -794,0 +815,0 @@ vpi.style("opacity", 0); |
59416
1715