From: Robert Konigsberg Date: Wed, 25 Jan 2012 16:23:23 +0000 (-0500) Subject: Apply firefox fix to the gallery. (We should remove the test altogether someday. :)) X-Git-Tag: v1.0.0~333 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=7d783e00abd566c6abb4ad936f1b53ee344aa48c;p=dygraphs.git Apply firefox fix to the gallery. (We should remove the test altogether someday. :)) --- diff --git a/gallery/interaction-api.js b/gallery/interaction-api.js index 38a5b68..08efc6f 100644 --- a/gallery/interaction-api.js +++ b/gallery/interaction-api.js @@ -62,6 +62,12 @@ function offsetToPercentage(g, offsetX, offsetY) { function dblClickV3(event, g, context) { // Reducing by 20% makes it 80% the original size, which means // to restore to original size it must grow by 25% + + if (!(event.offsetX && event.offsetY)){ + event.offsetX = event.layerX - event.target.offsetLeft; + event.offsetY = event.layerY - event.target.offsetTop; + } + var percentages = offsetToPercentage(g, event.offsetX, event.offsetY); var xPct = percentages[0]; var yPct = percentages[1]; @@ -89,6 +95,11 @@ function scrollV3(event, g, context) { // that verbatim, it would be a 7.5%. var percentage = normal / 50; + if (!(event.offsetX && event.offsetY)){ + event.offsetX = event.layerX - event.target.offsetLeft; + event.offsetY = event.layerY - event.target.offsetTop; + } + var percentages = offsetToPercentage(g, event.offsetX, event.offsetY); var xPct = percentages[0]; var yPct = percentages[1]; diff --git a/tests/interaction.js b/tests/interaction.js index c98c445..08efc6f 100644 --- a/tests/interaction.js +++ b/tests/interaction.js @@ -195,7 +195,7 @@ function upV4(event, g, context) { } function dblClickV4(event, g, context) { - restorePositioning(g4); + restorePositioning(g); } function drawV4(x, y) {