In my jsfiddle project, there is a white square that can be moved around by the mouse. When the mouse button is released, it displays the x and y coordinates of the square.
To see the project in action, visit: http://jsfiddle.net/35z4J/115/
One part of the code is responsible for showing the x and y coordinates of the center of the square:
stop: function(e) {
console.log("STOPPING");
var divheight= e.path[0].offsetHeight;
var divWidth= e.path[0].offsetWidth;
console.log(e.clientX+divWidth/2)
console.log(e.clientY+divheight/2)
},
I am confused about these two lines of code:
var divheight= e.path[0].offsetHeight;
var divWidth= e.path[0].offsetWidth;
I tried looking at the MouseEvent documentation here:
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
But could not find any information on path.offsetHeight
and path.OffsetWidth
. Can anyone point me to where I can learn more about this?