|
|
|
@ -18,36 +18,32 @@ var dAttributeFunction = d3.geoPath()
|
|
|
|
|
|
|
|
|
|
|
|
d3.selectAll('path').attr('d', dAttributeFunction);
|
|
|
|
d3.selectAll('path').attr('d', dAttributeFunction);
|
|
|
|
|
|
|
|
|
|
|
|
d3.selectAll('svg').on('click', function(datum){
|
|
|
|
|
|
|
|
console.log(worldProjection.invert(d3.mouse(this)));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dragBehavior = d3.drag() //create a drag behavior
|
|
|
|
var dragBehavior = d3.drag() //create a drag behavior
|
|
|
|
.on('start', function(){
|
|
|
|
.on('start', function(event){
|
|
|
|
d3.select('table tr:nth-child(2) td:first-child')
|
|
|
|
d3.select('table tr:nth-child(2) td:first-child')
|
|
|
|
.html(worldProjection.invert(d3.mouse(this))[0])
|
|
|
|
.html(worldProjection.invert([event.x, event.y])[0])
|
|
|
|
d3.select('table tr:nth-child(2) td:last-child')
|
|
|
|
d3.select('table tr:nth-child(2) td:last-child')
|
|
|
|
.html(worldProjection.invert(d3.mouse(this))[1])
|
|
|
|
.html(worldProjection.invert([event.x, event.y])[1])
|
|
|
|
|
|
|
|
|
|
|
|
d3.selectAll('rect').remove();
|
|
|
|
d3.selectAll('rect').remove();
|
|
|
|
d3.select('svg').append('rect')
|
|
|
|
d3.select('svg').append('rect')
|
|
|
|
.attr('x', d3.mouse(this)[0])
|
|
|
|
.attr('x', event.x)
|
|
|
|
.attr('y', d3.mouse(this)[1]);
|
|
|
|
.attr('y', event.y);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.on('drag', function(){
|
|
|
|
.on('drag', function(event){
|
|
|
|
d3.select('table tr:nth-child(3) td:first-child')
|
|
|
|
d3.select('table tr:nth-child(3) td:first-child')
|
|
|
|
.html(worldProjection.invert(d3.mouse(this))[0])
|
|
|
|
.html(worldProjection.invert([event.x, event.y])[0])
|
|
|
|
d3.select('table tr:nth-child(3) td:last-child')
|
|
|
|
d3.select('table tr:nth-child(3) td:last-child')
|
|
|
|
.html(worldProjection.invert(d3.mouse(this))[1])
|
|
|
|
.html(worldProjection.invert([event.x, event.y])[1])
|
|
|
|
|
|
|
|
|
|
|
|
d3.select('rect').attr('width', d3.mouse(this)[0]-d3.select('rect').attr('x'))
|
|
|
|
d3.select('rect').attr('width', event.x-d3.select('rect').attr('x'))
|
|
|
|
d3.select('rect').attr('height', d3.mouse(this)[1]-d3.select('rect').attr('y'))
|
|
|
|
d3.select('rect').attr('height', event.y-d3.select('rect').attr('y'))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
d3.select('svg').call(dragBehavior);
|
|
|
|
d3.select('svg').call(dragBehavior);
|
|
|
|
|
|
|
|
|
|
|
|
d3.select('form').on('submit', function(){
|
|
|
|
d3.select('form').on('submit', function(event){
|
|
|
|
d3.event.preventDefault();
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
d3.selectAll('rect').remove();
|
|
|
|
d3.selectAll('rect').remove();
|
|
|
|
|
|
|
|
|
|
|
|
|