X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-utils.js;h=0e8cf2358e039a8c6ba4d385c0fb5aac64345e8f;hb=d3b494307a47a61c2b0495ff36dcead00812213e;hp=6ca025fe0a83c0aaa91dc5a38ca5bbbd1f3879bc;hpb=3c3b0a9da6dce1301dcccc6968e30b4792d4d3bd;p=dygraphs.git diff --git a/dygraph-utils.js b/dygraph-utils.js index 6ca025f..0e8cf23 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -291,6 +291,8 @@ Dygraph.findPosX = function(obj) { 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; @@ -322,6 +324,8 @@ Dygraph.findPosY = function(obj) { 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; @@ -873,7 +877,7 @@ Dygraph.repeatAndCleanup = function(repeatFn, maxFrames, framePeriodInMillis, repeatFn(maxFrameArg); // Ensure final call with maxFrameArg. cleanupFn(); } else { - if (frameDelta != 0) { // Don't call repeatFn with duplicate frames. + if (frameDelta !== 0) { // Don't call repeatFn with duplicate frames. repeatFn(frameNumber); } loop(); @@ -1029,7 +1033,6 @@ Dygraph.regularShape_ = function( delta = delta || Math.PI * 2 / sides; ctx.beginPath(); - var first = true; var initialAngle = rotationRadians; var angle = initialAngle; @@ -1213,3 +1216,20 @@ Dygraph.detectLineDelimiter = function(data) { return null; }; + +/** + * Is one element contained by another? + * @param {Element} containee The contained element. + * @param {Element} container The container element. + * @return {boolean} Whether containee is inside (or equal to) container. + * @private + */ +Dygraph.isElementContainedBy = function(containee, container) { + if (container === null || containee === null) { + return false; + } + while (containee && containee !== container) { + containee = containee.parentNode; + } + return (containee === container); +};