In this part of the application - I am trying to rescale a path shape and keep it inside the viewport.
I've managed to rescale the shape accordingly by the translation needs to be adjusted to keep it inside the view port.
http://jsfiddle.net/pPMqQ/101/
rescalePath: function(zoomLevel){
//now need to rescale the path so the map and the region match?
var ratioX = zoomLevel/this.width;
var ratioY = zoomLevel/this.height;
this.svg.attr("transform", "scale("+zoomLevel+") translate("+ratioX+", "+ratioY+")");
},
bindEvents: function(){
var that = this;
$(".up").click(function(e) {
e.preventDefault();
that.rescalePath(3);
});
$(".down").click(function(e) {
e.preventDefault();
that.rescalePath(12);
});
}
What is the best way of achieving this? - Surely its not right to set the translate information - is there not a function that will keep the projection in the center - ideally this will be part of a zoom/pan to sit on top of a google map - so to match the movement/pan of the map along with the zoom.