From 7d783e00abd566c6abb4ad936f1b53ee344aa48c Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Wed, 25 Jan 2012 11:23:23 -0500 Subject: [PATCH] Apply firefox fix to the gallery. (We should remove the test altogether someday. :)) --- gallery/interaction-api.js | 11 +++++++++++ tests/interaction.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) 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) { -- 2.7.4