Martijn Dashorst created WICKET-5869:
----------------------------------------

             Summary: Kittencaptcha doesn't calculate click y-coordinate 
correctly
                 Key: WICKET-5869
                 URL: https://issues.apache.org/jira/browse/WICKET-5869
             Project: Wicket
          Issue Type: Bug
          Components: wicket-extensions
    Affects Versions: 6.19.0, 6.18.0, 6.17.0, 6.16.0, 6.15.0, 6.14.0
            Reporter: Martijn Dashorst
            Priority: Minor
             Fix For: 6.20.0, 7.0.0-M6


In firefox the click event doesn't calculate the relative position of the click 
correctly.

In the block when the event doesn't have an offsetX/Y, the code should take 
into account all offsets of all offsetParents. The code below fixes this.

{code:javascript}
function getEventX(element, event) {
        var result;
        if (event.offsetX != null) {
                result = event.offsetX;
        } else {
                result = event.pageX;
                do {
                        result = result - element.offsetLeft;
                        element = element.offsetParent;
                } while (element != null)
        }
        return parseInt(result, 10);
}
function getEventY(element, event) {
        var result;
        if (event.offsetY != null) {
                result = event.offsetY;
        } else {
                result = event.pageY;
                do {
                        result = result - element.offsetTop;
                        element = element.offsetParent;
                } while (element != null)
        }
        return parseInt(result, 10);
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to