|
|
|
|
@ -28,12 +28,20 @@ var dragBehavior = d3.drag() //create a drag behavior
|
|
|
|
|
.html(worldProjection.invert(d3.mouse(this))[0])
|
|
|
|
|
d3.select('table tr:nth-child(2) td:last-child')
|
|
|
|
|
.html(worldProjection.invert(d3.mouse(this))[1])
|
|
|
|
|
|
|
|
|
|
d3.selectAll('rect').remove();
|
|
|
|
|
d3.select('svg').append('rect')
|
|
|
|
|
.attr('x', d3.mouse(this)[0])
|
|
|
|
|
.attr('y', d3.mouse(this)[1]);
|
|
|
|
|
})
|
|
|
|
|
.on('drag', function(){
|
|
|
|
|
d3.select('table tr:nth-child(3) td:first-child')
|
|
|
|
|
.html(worldProjection.invert(d3.mouse(this))[0])
|
|
|
|
|
d3.select('table tr:nth-child(3) td:last-child')
|
|
|
|
|
.html(worldProjection.invert(d3.mouse(this))[1])
|
|
|
|
|
|
|
|
|
|
d3.select('rect').attr('width', d3.mouse(this)[0]-d3.select('rect').attr('x'))
|
|
|
|
|
d3.select('rect').attr('height', d3.mouse(this)[1]-d3.select('rect').attr('y'))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
d3.select('svg').call(dragBehavior);
|
|
|
|
|
|