Mercurial > repos > other > exif-graphr
changeset 4:ce99564f2eb5
Fix legend hover so that it doesn't stop in gap between label and gradient
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 29 May 2017 14:58:18 +0100 |
parents | c1d89ae900d5 |
children | 457823710044 |
files | exif-graphr.js |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/exif-graphr.js Mon May 29 14:31:41 2017 +0100 +++ b/exif-graphr.js Mon May 29 14:58:18 2017 +0100 @@ -330,19 +330,19 @@ var cameraLegends = legends.selectAll("g").data(cameras, byValue); cameraLegends.exit().remove(); var newCameraLegends = cameraLegends.enter().append("g") + .on('mouseover', function(d) { setCircleOpacity(d, 0.1); }) + .on('mouseout', function(d) { setCircleOpacity(d, 1); }); newCameraLegends.append("title").text(function(d){return d;}); + newCameraLegends.append("text") + .text(function(d){ return ": " + d; }) //Fudge positioning so that hover opacity doesn't stop between gradient and label + .attr("x", legendBlockWidth - 5) + .attr("y", function(d,i) { return i * legendBlockHeight + (legendBlockHeight / 4) * 3; }) newCameraLegends.append("rect") .attr("x", 0) .attr("y", function(d,i){ return i * legendBlockHeight; }) .attr("width", legendBlockWidth) .attr("height", legendBlockHeight) .attr("fill", function(d,i) { return "url(#Gradient" + i + ")"; }) - .on('mouseover', function(d) { setCircleOpacity(d, 0.1); }) - .on('mouseout', function(d) { setCircleOpacity(d, 1); }); - newCameraLegends.append("text") - .text(function(d){ return d; }) - .attr("x", legendBlockWidth + 5) - .attr("y", function(d,i) { return i * legendBlockHeight + (legendBlockHeight / 4) * 3; }); } function setCircleOpacity(camera, opacity) {