Commit 4b670228 authored by JC Brand's avatar JC Brand

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

parent daa31794
...@@ -597,8 +597,8 @@ ...@@ -597,8 +597,8 @@
var ctx = this.$el.find('canvas').get(0).getContext('2d'); var ctx = this.$el.find('canvas').get(0).getContext('2d');
var img = new Image(); // Create new Image object var img = new Image(); // Create new Image object
img.onload = function(){ img.onload = function(){
// execute drawImage statements here var ratio = img.width/img.height;
ctx.drawImage(img,0,0, 35, 35) ctx.drawImage(img,0,0, 35*ratio, 35)
} }
img.src = img_src; img.src = img_src;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment