From 417af431300573b3069ddcb9b9b26cd3cb40c051 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Josep=20Llodr=C3=A0?= Date: Wed, 25 Jan 2012 11:48:23 +0100 Subject: [PATCH] event.offsetX and Y fixed for Firefox in interaction.js --- tests/interaction.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/interaction.js b/tests/interaction.js index ced5aef..c98c445 100644 --- a/tests/interaction.js +++ b/tests/interaction.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]; -- 2.7.4