The demo I'm working on is based on World tour, which uses canvas instead of SVG, so I cannot attach mouse event to country path to find what country was clicked. Is there any way to find which feature contains lat/long I get from mouse coordinates?
var canvas = d3.select("canvas")
.on("mousemove", function() {
var p = d3.mouse(canvas.node());
console.log(projection.invert(p)); // which country contains these coordinates?
});
var countries;
queue()
.defer(d3.json, 'world-110m.json.txt')
.defer(d3.tsv, 'world-country-names.tsv')
.await(function ready(error, world, names) {
countries = topojson.feature(world, world.objects.countries).features;
});