Browse Source

Fix canvas image ratio (don't stretch or squash)

JC Brand 12 years ago
parent
commit
4b670228ff
1 changed files with 2 additions and 2 deletions
  1. 2 2
      converse.js

+ 2 - 2
converse.js

@@ -597,8 +597,8 @@
             var ctx = this.$el.find('canvas').get(0).getContext('2d');
             var img = new Image();   // Create new Image object
             img.onload = function(){
-                // execute drawImage statements here
-                ctx.drawImage(img,0,0, 35, 35)
+                var ratio = img.width/img.height;
+                ctx.drawImage(img,0,0, 35*ratio, 35)
             }
             img.src = img_src;