190
rated 0 times
[
194]
[
4]
/ answers: 1 / hits: 17018
/ 11 Years ago, mon, september 2, 2013, 12:00:00
I would like to get mouse coordinates relative to parent or any other element in the DOM other than this
but I keep getting
Uncaught TypeError: Object [object Array] has no method 'getBoundingClientRect' d3.v3.min.js:1
H d3.v3.min.js:1
vo.mouse d3.v3.min.js:3
(anonymous function) index.html:291
(anonymous function)
My code :
.on(mouseup, function(d){
var th = d3.select( this );
var coordinates = [0, 0];
coordinates = d3.mouse( d3.select(body) );
console.log( coordinates[1] );
console.log( window );
//th.attr(cy, d3.mouse),
//d.newY = th.attr(cy);
console.log(d);
});
As far as I have noticed I can only get mouse coordinates relative to element that I have attached .on(mouseup, ...)
event listener.
Is there a way to get those coordinates relative to other element in the DOM ?
More From » d3.js