Hello,
My first post, so first a quick thank you to everyone contributing.
I'm a bit confused about how scaling works in geo projections vs d3.behavior.zoom. In an example
in this thread, when configuring the projection, the scale is set to (1 << 19):
.center([-122.4183, 37.7750]) // temporarily set center
.translate([width / 2, height / 2])
.translate(projection([0, 0])) // compute appropriate translate
.center([0, 0]); // reset
.scale(projection.scale())
.translate(projection.translate());
The zoom then receives the same scale and translate as the projection. But typically the zoom is applied by transforming an svg grouping element on zoom events, like this:
g.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
If the zoom scale were to be set to the same as the projection's scale, then the element would be scaled twice (first through drawing a path via a projection, then again by scaling the element that contains it). I don't want to scale by 1 << 19. I just want want my projection to initially be "bigger", then use that as my base point.
Perhaps I am using the zoom.behavior incorrectly. How do you typically keep your zoom/transform state in sync with your projection? "
Let the zoom behavior drive the projection", but the snippet above does the opposite if you call it during a zoom event.
Yours,
Jason