if(obj.offsetParent) {
var copyObj = obj;
while(1) {
+ var borderLeft = getComputedStyle(copyObj).borderLeft || "0";
+ curleft += parseInt(borderLeft, 10) ;
curleft += copyObj.offsetLeft;
if(!copyObj.offsetParent) {
break;
if(obj.offsetParent) {
var copyObj = obj;
while(1) {
+ var borderTop = getComputedStyle(copyObj).borderTop || "0";
+ curtop += parseInt(borderTop, 10) ;
curtop += copyObj.offsetTop;
if(!copyObj.offsetParent) {
break;
* Returns a two-element array: [X, Y].
*/
Dygraph.prototype.eventToDomCoords = function(event) {
- var canvasx = Dygraph.pageX(event) - Dygraph.findPosX(this.mouseEventElement_);
- var canvasy = Dygraph.pageY(event) - Dygraph.findPosY(this.mouseEventElement_);
- return [canvasx, canvasy];
+ if (event.offsetX && event.offsetY) {
+ return [ event.offsetX, event.offsetY ];
+ } else {
+ var canvasx = Dygraph.pageX(event) - Dygraph.findPosX(this.mouseEventElement_);
+ var canvasy = Dygraph.pageY(event) - Dygraph.findPosY(this.mouseEventElement_);
+ return [canvasx, canvasy];
+ }
};
/**