2

https://github.com/sethladd/bad-aliens-dart/blob/master/web/Game.dartから次のコードを見つけました:

    ClientRect rect = ctx.canvas.getBoundingClientRect();
    clientBoundingRect = new GamePoint(rect.left, rect.top);
...
    GamePoint getXandY(e) {
      num x =  e.clientX - clientBoundingRect.x - (ctx.canvas.width/2);
      num y = e.clientY - clientBoundingRect.y - (ctx.canvas.height/2);
      return new GamePoint(x, y);
    }

テストしましたが、キャンバス内の適切なマウス位置を計算しません。

4

1 に答える 1