Remove ratio = 1 as default

This commit is contained in:
Nicolas Le Goff
2013-03-21 12:46:00 +01:00
parent ae78df11af
commit 3dc3caf137
2 changed files with 10 additions and 7 deletions

View File

@@ -131,9 +131,9 @@
{% set height = record.get_technical_infos(dataH) %}
{% if width and height %}
{% set ratio = (width / height) %}
{% set ratio = width / height %}
{% else %}
{% set ratio = 1 %}
{% set ratio = '' %}
{% endif %}
<video id="thumb_video" controls="" preload="auto" data-ratio="{{ ratio }}">

View File

@@ -13,13 +13,16 @@
var w = elementDomNode.getWidth();
var maxH = elementDomNode.getHeight();
if ('' !== elementDomNode.getAspectRatio()) {
var h = Math.round(w * (1 / elementDomNode.getAspectRatio()));
if (h > maxH) {
var h = maxH;
var w = Math.round(h * elementDomNode.getAspectRatio());
}
} else {
var h = maxH;
}
this.domCanva.setAttribute("width", w);
this.domCanva.setAttribute("height", h);
@@ -102,7 +105,7 @@
var Video = function(domElement){
Image.call(this, domElement);
this.aspectRatio = domElement.getAttribute('data-ratio') || 1;
this.aspectRatio = domElement.getAttribute('data-ratio');
};
Video.prototype = new Image();