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
Post a Comment