You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martijn Dashorst (JIRA)" <ji...@apache.org> on 2015/04/01 17:32:54 UTC

[jira] [Resolved] (WICKET-5869) Kittencaptcha doesn't calculate click y-coordinate correctly

     [ https://issues.apache.org/jira/browse/WICKET-5869?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martijn Dashorst resolved WICKET-5869.
--------------------------------------
    Resolution: Fixed
      Assignee: Martijn Dashorst

> 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.14.0, 6.15.0, 6.16.0, 6.17.0, 6.18.0, 6.19.0
>            Reporter: Martijn Dashorst
>            Assignee: 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)