javascript - d3.js Rescaling shape path and keeping it in the center -


enter image description here

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

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -