Qt Reference Documentation

workerscript.js Example File

declarative/threading/workerscript/workerscript.js
 var lastx = 0;
 var lasty = 0;

 WorkerScript.onMessage = function(message) {
     var ydiff = message.y - lasty;
     var xdiff = message.x - lastx;

     var total = Math.sqrt(ydiff * ydiff + xdiff * xdiff);

     lastx = message.x;
     lasty = message.y;

     WorkerScript.sendMessage( {xmove: xdiff, ymove: ydiff, move: total} );
 }
X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.