NEW FEATURE: make orthographic maps rotatable
an option to make orthographic maps rotatable, based on this example by jason davies.
i've also created an issue.
@unilogue Can you put your code edit just inside of /src/js/datamaps.js instead of the built file?
@markmarkoh that's the thing, i don't know how to incorporate the code from that file into the datamaps.js, it seems to be incompatible. i just wanted to post that as an example, i was hoping someone would know how to implement this feature into datamaps..
This looks like it could work! Taken from here.
I tried copying it into a done callback but nothing happened, any ideas?
var dragBehaviour = d3.behavior.drag()
.on('drag', function(){
var dx = d3.event.dx;
var dy = d3.event.dy;
var rotation = projection.rotate();
var radius = projection.scale();
var scale = d3.scale.linear()
.domain([-1 * radius, radius])
.range([-90, 90]);
var degX = scale(dx);
var degY = scale(dy);
rotation[0] += degX;
rotation[1] -= degY;
if (rotation[1] > 90) rotation[1] = 90;
if (rotation[1] < -90) rotation[1] = -90;
if (rotation[0] >= 180) rotation[0] -= 360;
projection.rotate(rotation);
redraw();
})
Any solution for this?
yup! https://stackoverflow.com/questions/33850471/make-d3-js-datamap-rotate-by-dragging-with-cursor
Is there a way to make the map auto rotate?