javascript - d3.js Rescaling shape path and keeping it in the center -
in part of application - trying rescale path shape , keep inside viewport.
i've managed rescale shape accordingly translation needs adjusted keep inside view port.
http://jsfiddle.net/ppmqq/101/
rescalepath: function(zoomlevel){ //now need rescale path map , region match? var ratiox = zoomlevel/this.width; var ratioy = zoomlevel/this.height; this.svg.attr("transform", "scale("+zoomlevel+") translate("+ratiox+", "+ratioy+")"); }, bindevents: function(){ var = this; $(".up").click(function(e) { e.preventdefault(); that.rescalepath(3); }); $(".down").click(function(e) { e.preventdefault(); that.rescalepath(12); }); }
what best way of achieving this? - surely not right set translate information - there not function keep projection in center - ideally part of zoom/pan sit on top of google map - match movement/pan of map along zoom.
Comments
Post a Comment