mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 18:33:13 +00:00
Remove ratio = 1 as default
This commit is contained in:
@@ -131,9 +131,9 @@
|
|||||||
{% set height = record.get_technical_infos(dataH) %}
|
{% set height = record.get_technical_infos(dataH) %}
|
||||||
|
|
||||||
{% if width and height %}
|
{% if width and height %}
|
||||||
{% set ratio = (width / height) %}
|
{% set ratio = width / height %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set ratio = 1 %}
|
{% set ratio = '' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<video id="thumb_video" controls="" preload="auto" data-ratio="{{ ratio }}">
|
<video id="thumb_video" controls="" preload="auto" data-ratio="{{ ratio }}">
|
||||||
|
|||||||
@@ -13,14 +13,17 @@
|
|||||||
var w = elementDomNode.getWidth();
|
var w = elementDomNode.getWidth();
|
||||||
var maxH = elementDomNode.getHeight();
|
var maxH = elementDomNode.getHeight();
|
||||||
|
|
||||||
var h = Math.round(w * (1 / elementDomNode.getAspectRatio()));
|
if ('' !== elementDomNode.getAspectRatio()) {
|
||||||
|
var h = Math.round(w * (1 / elementDomNode.getAspectRatio()));
|
||||||
|
|
||||||
if (h > maxH) {
|
if (h > maxH) {
|
||||||
|
var h = maxH;
|
||||||
|
var w = Math.round(h * elementDomNode.getAspectRatio());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
var h = maxH;
|
var h = maxH;
|
||||||
var w = Math.round(h * elementDomNode.getAspectRatio());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.domCanva.setAttribute("width", w);
|
this.domCanva.setAttribute("width", w);
|
||||||
this.domCanva.setAttribute("height", h);
|
this.domCanva.setAttribute("height", h);
|
||||||
|
|
||||||
@@ -102,7 +105,7 @@
|
|||||||
|
|
||||||
var Video = function(domElement){
|
var Video = function(domElement){
|
||||||
Image.call(this, domElement);
|
Image.call(this, domElement);
|
||||||
this.aspectRatio = domElement.getAttribute('data-ratio') || 1;
|
this.aspectRatio = domElement.getAttribute('data-ratio');
|
||||||
};
|
};
|
||||||
|
|
||||||
Video.prototype = new Image();
|
Video.prototype = new Image();
|
||||||
|
|||||||
Reference in New Issue
Block a user