How do I adjust zoom size for a point in D3?

前端 未结 2 2142
说谎
说谎 2020-12-31 20:29

This could be a classic case of \"you\'re doing it wrong\", but all of my searching to date hasn\'t warranted any help.

Here\'s my scenario:

I\'m using an al

2条回答
  •  爱一瞬间的悲伤
    2020-12-31 21:12

    For things you don't want to scale, just make them divided by 'scale' . In my case,

    var zoom = d3.behavior.zoom()
        .on("zoom",function() {
            g.attr("transform","translate("+d3.event.translate.join(",")+")scale("+d3.event.scale+")");
    
            g.selectAll(".mapmarker")  
            .attr("r",6/d3.event.scale)
            .attr("stroke-width",1/d3.event.scale);
    
    });
    

提交回复
热议问题