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 - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -