O'Reilly logo

Pro ASP.NET SignalR: Real-Time Communication in .NET with SignalR 2.1 by Darren White, Keyvan Nayyeri

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Listing 10-116. User Input Capture Methods

function getDrawPosition(e) {    var canvasRect = document.getElementById('scratchCanvas').getBoundingClientRect();    var xPos = e.clientX - canvasRect.left;    var yPos = e.clientY - canvasRect.top;    return new Position(xPos, yPos);}function mouseMove(e) {    canvasBrushMove(getDrawPosition(e));}function mouseDown(e) {    canvasBrushDown(getDrawPosition(e));}function mouseUp(e) {    canvasBrushUp(getDrawPosition(e));}function msTouchStart(e) {    e.preventDefault();    if (firstTouch == null && e.buttons == 1) {        firstTouch = e.pointerId;        canvasBrushDown(new Position(e.clientX, e.clientY));    }}function msTouchMove(e) {    e.preventDefault();    if (firstTouch == e.pointerId) {         ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required