1

Icon moves when I move the mouse, but it doesn't move to the last position when I stop moving.

I used Paper.js for this.

My code:

    function setMousePosition(data) {
      var yyy;
      var deltaX;

      for (var i = 0; i < playersData.length; i++) {

        var element = playersData[i];

        if (element.playerName == data.playerName) {

         // element.cursor.position = new Point(data.position[1], data.position[2]);

          deltaX = (data.position[1] - element.cursor.position.x) / (100);
          yyy = (data .position[2] - element.cursor.position.y) / (100);

         var lastx =  element.cursor.position.x + deltaX;
         var lasty =  element.cursor.position.y + yyy;




          element.cursor.position = new Point(lastx,lasty);

        }

      }

    }

Icon doesn't move to cursor end position.

Tarık CAN
  • 41
  • 4

0 Answers0