title: D3 V4 zoom to feature in canvas with stream projection
body: <p>I'm trying to zoom to fit a <code>feature</code> in a streamed projection in canvas. I can already <a href="https://bl.ocks.org/Lacroute/579bc326fb547110a959c0a9ac2b30ce" rel="nofollow noreferrer">select a feature</a>, but I can't achieve the zoom.</p>
  
  <p>The method is simple, retrieve a feature, compute his centroid, and then apply a zoom transition to this point.</p>
  
  <p>A very sumarized piece of code:</p>
  
  <pre><code>// variables
  var land = topojson.feature(us, us.objects.states)
  var minZ // minimum area threshold for simplification
  
  var transform = d3.geoIdentity().clipExtent([[0, 0], [width, height]])
  var simplify = d3.geoTransform({
    point: function(x, y, z) { if (z &gt;= minZ) this.stream.point(x, y)}
  })
  
  var path = d3.geoPath().projection({
    stream: function(s) { return simplify.stream(transform.stream(s)); }
  })
  .context(context);
  
  // It's called backedProjection because the topojson is already projected with this
  var backedProjection = d3.geoMercator().translate([0, 0]).scale(4000)
  
  
  // zoom handler 
  function zoomed(d) {
    var t = d3.event.transform;
    minZ = 1 / (t.k * t.k);
    transform.translate([t.x, t.y]).scale(t.k);
  }
  
  
  // click handler
  function onClick() {
    let target = backedProjection(d3.geoCentroid(land));  
  
    let selectedTransform = d3.zoomIdentity
      .translate(width / 2, height / 2)
      .scale(0.05)
      .translate(-target[0], -target[1])
  
    // Apply the new transform
    canvas.transition()
      .duration(750)
      .call(
        zoom.transform,
        selectedTransform
    )
  }
  </code></pre>
  
  <p>The stream projection system is a fork of @mbostock blocks <a href="https://bl.ocks.org/mbostock/7755778" rel="nofollow noreferrer">https://bl.ocks.org/mbostock/7755778</a></p>
  
  <p>Here is my block to test > 
  <a href="http://blockbuilder.org/Lacroute/af1b46da4cb4579f93986b0119635ec2" rel="nofollow noreferrer">http://blockbuilder.org/Lacroute/af1b46da4cb4579f93986b0119635ec2</a></p>
  
  <p>Does anyone have an idea of why the zoom is broken?
  Thanks for the help.</p>