[Dart] MouseEvent ClientX and ClientY Deprecated
source link: http://siongui.github.io/2015/02/16/dart-MouseEvent-clientX-clientY-deprecated/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
[Dart] MouseEvent ClientX and ClientY Deprecated
February 16, 2015
Recently I am porting JavaScript code to Dart. When I write the following code:
int dx = e.clientX - initialMouseX;
It works on Dartium. Then I compiled the code to JavaScript by dart2js. The compiled JavaScript code failed to run on Chromium. After some Googling, I found Dart MouseEvent clientX and clientY deprecated ([1], [2], [4]). And I also found someone got the same problem as me ([3]). The correct way to get clientX and clientY in Dart should be:
int dx = e.client.x - initialMouseX;
Then the compiled JavaScript code runs on Chromium without trouble.
PS: Tested on Dart 1.8
References:
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK