Skip to content

Commit

Permalink
Fix problem with scaling media creating badly skewed images
Browse files Browse the repository at this point in the history
Fixes #188
  • Loading branch information
nervetattoo committed Oct 24, 2013
1 parent c833582 commit 74d80d3
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions design/ezexceed/javascript/views/scaler.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,24 @@ define(['keymedia/view', './scaled_version', 'jquery-safe', 'keymedia/templates/

updateScalerSize : function(media)
{
var file = media.get('file');
var width = this.$el.width();
var height = this.$el.height() - 100;
var file = media.get('file');
if (width > file.width) width = file.width;
if (height > file.height) height = file.height;
var ratio = file.width / file.height;

if (ratio > 1) {
// Wide media
if (file.width < width) width = file.width;
height = width * ratio;
}
else {
// Tall media
if (file.height < height) height = file.height;
width = height * ratio;
}
this.SIZE = {
w : width,
h : height
w : parseInt(width, 10),
h : parseInt(height, 10)
};
return this;
},
Expand Down

0 comments on commit 74d80d3

Please sign in to comment.