source: trunk/examples/declarative/threading/workerscript/workerscript.js@ 846

Last change on this file since 846 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 331 bytes
Line 
1var lastx = 0;
2var lasty = 0;
3
4WorkerScript.onMessage = function(message) {
5 var ydiff = message.y - lasty;
6 var xdiff = message.x - lastx;
7
8 var total = Math.sqrt(ydiff * ydiff + xdiff * xdiff);
9
10 lastx = message.x;
11 lasty = message.y;
12
13 WorkerScript.sendMessage( {xmove: xdiff, ymove: ydiff, move: total} );
14}
15
Note: See TracBrowser for help on using the repository browser.