javascript - Resizing canvas to full browser window width and height -


i'm playing around node/socket.io pictionary game. apologize in advance, designer , not keen js.

i'm trying re-size canvas entire width , height of browser window without scaling stroke path? right now, javascript sets canvas 500px.

here relevant code:

// ================================================ //                           canvas drawing section // ================================================  var canvas = $('#canvas'),     context = canvas[0].getcontext('2d');  socket.on('drawcanvas', function(canvastodraw) {     if(canvastodraw) {         canvas.width(500);         context.linejoin = 'round';         context.linewidth = 2;          // ...     } }); 

canvas[0].width = $(window).width(); canvas[0].height = $(window).height(); 

worked great.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -