Skip to main content
100%

Correct zoom of layout

✓ Published0🌍 Public
PPacsangon
Last edited May 31, 2013
Created on Jul 27, 2016

This example demonstrates improved zoom behavior for a D3.js layout where a background rectangle maintains full coverage of the SVG viewport during pan and zoom operations. It uses the `d3.behavior.zoom` API with a `scaleExtent` of [0.2, 5] to constrain zoom limits. The rescale function applies an inverse transform to the rectangle, using `1 / d3.event.scale` to counteract the group’s scale transformation, ensuring the drag target remains correctly sized and positioned at all zoom levels.

AI-generated description

Similar vizzes