New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MouseEvent.offsetX not working in firefox #1087
Comments
Set owner to @rakudrama. |
This comment was originally written by @bp74 Just found the same problem. The reason is that Firefox does not set the "offsetX" and "offsetY" properties. The question is: should i do a workaround in my code or will the Dart2JS compiler add a workaround? I think the Dart2JS compiler should fix it, because people expect a consistent behaviour of Dart-objects (events) in all browsers. |
This comment was originally written by @bp74 I found the following post on the bugzilla forum. It would be great if frog could generate code like this: https://bugzilla.mozilla.org/show_bug.cgi?id=69787#c37 Btw. i have tried to write a workaround in Dart, but it is really hard! You have to check all "offsetParent" of the element (in my case a Canvas) and than you have to call "element.rect" and get a Future<ElementRect> ... now you have to wait for all futures to complete, sum up all the "offset.left" and "offset.top" and now you have the coordinates of your element. Of course you can't do this when the mouse-events fires because you have to know the result right in the event handler ... very very hard! |
This comment was originally written by @bp74 Here is the code i use to calculate to location of an element, is there a more simple way? Future<Point> _calculateElementLocation(html.Element element) |
This comment was originally written by @bp74 Found a much better solition on StackOverflow: _canvas.rect.then((ElementRect rect) { |
Added this to the M1 milestone. |
Removed the owner. |
Set owner to @blois. |
Added Accepted label. |
Added Fixed label. |
This issue was originally filed by Peter.p...@gmail.com
What steps will reproduce the problem?
{{{
void main() {
document.query('body').on.mouseDown.add((MoueseEvent e) {
document.query('#status').innerHTML = e.offsetX + ", " + e.offsetY;
});
}
}}}
What is the expected output? What do you see instead?
Expected result:
offsetX should not be undefined
#status field should show mouse coordinates
Actual result:
Error: val1 is undefined
Source File: ..../Bug.dart.app.js
Line: 83
What version of the product are you using? On what operating system?
Dart Editor: 0.1.0.201112130441, Build 2380
Firefox: 9.0.1
OS: Ubuntu
Please provide any additional information below.
The text was updated successfully, but these errors were encountered: