Permalink
Browse files

fix .style.width forgot px

:)
  • Loading branch information...
1 parent 88f805c commit de5343bdffa4d9c14a5c92eeb85d6cbde147dc60 @tj tj committed Oct 1, 2012
Showing with 4 additions and 5 deletions.
  1. +2 −3 index.js
  2. +2 −2 test.html
View
@@ -11,11 +11,10 @@ module.exports = function(canvas){
var ctx = canvas.getContext('2d');
var ratio = window.devicePixelRatio || 1;
if (1 != ratio) {
- canvas.style.width = canvas.width;
- canvas.style.height = canvas.height;
+ canvas.style.width = canvas.width + 'px';
+ canvas.style.height = canvas.height + 'px';
canvas.width *= ratio;
canvas.height *= ratio;
- ctx.scale(ratio, ratio);
}
return canvas;
};
View
@@ -3,6 +3,6 @@
var canvas = document.querySelector('canvas');
var ctx = canvas.getContext('2d');
ctx.strokeRect(0, 0, 200, 200);
- ctx.font = '28px Helvetica';
- ctx.fillText('[o_O]', 60, 100);
+ ctx.arc(100, 100, 50, 0, Math.PI * 2, false);
+ ctx.stroke();
</script>

0 comments on commit de5343b

Please sign in to comment.