Fixed function calls in Resizer.js (zoom and stretcher). ApplyConditionalStretch, computeOffsets and applyCss are still TODO
This commit is contained in:
parent
547ef7ad7b
commit
748ed8293d
@ -3,8 +3,9 @@ if(Debug.debug)
|
|||||||
|
|
||||||
var StretchMode = {
|
var StretchMode = {
|
||||||
NO_STRETCH: 0,
|
NO_STRETCH: 0,
|
||||||
CONDITIONAL: 1,
|
BASIC: 1,
|
||||||
FULL: 2
|
HYBRID: 2,
|
||||||
|
CONDITIONAL: 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ class Resizer {
|
|||||||
this.stopCssWatcher();
|
this.stopCssWatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setAr(ar, lastAr){
|
setAr(ar, lastAr){
|
||||||
if(Debug.debug){
|
if(Debug.debug){
|
||||||
console.log('[Resizer::setAr] trying to set ar. New ar:', ar)
|
console.log('[Resizer::setAr] trying to set ar. New ar:', ar)
|
||||||
@ -66,33 +68,34 @@ class Resizer {
|
|||||||
this.videoData.destroy();
|
this.videoData.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
var zoomFactors = this.scaler.calculateCrop(ar);
|
|
||||||
|
|
||||||
if(! zoomFactors || zoomFactors.error){
|
if (this.stretch.mode === StretchMode.NO_STRETCH || this.stretch.mode === StretchMode.CONDITIONAL){
|
||||||
if(Debug.debug){
|
var stretchFactors = this.scaler.calculateCrop(ar);
|
||||||
console.log("[Resizer::setAr] failed to set AR due to problem with calculating crop. Error:", (zoomFactors ? zoomFactors.error : zoomFactors));
|
|
||||||
|
if(! stretchFactors || stretchFactors.error){
|
||||||
|
if(Debug.debug){
|
||||||
|
console.log("[Resizer::setAr] failed to set AR due to problem with calculating crop. Error:", (stretchFactors ? stretchFactors.error : stretchFactors));
|
||||||
|
}
|
||||||
|
if(dimensions.error === 'no_video'){
|
||||||
|
this.conf.destroy();
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if(dimensions.error === 'no_video'){
|
if(this.stretch.mode === StretchMode.CONDITIONAL){
|
||||||
this.conf.destroy();
|
this.stretcher.applyConditionalStretch(stretchFactors, ar);
|
||||||
}
|
}
|
||||||
return;
|
} else if (this.stretch.mode === StretchMode.HYBRID) {
|
||||||
|
var stretchFactors = this.stretcher.calculateStretch(ar);
|
||||||
}
|
}
|
||||||
|
|
||||||
var stretchFactors = undefined;
|
this.zoom.applyZoom(stretchFactors);
|
||||||
|
|
||||||
// if we set stretching, we apply stretching
|
//TODO: correct these two
|
||||||
if (this.stretch.mode == StretchMode.FULL){
|
var cssOffsets = this.computeOffsets(stretchFactors);
|
||||||
this.stretcher.calculateStretch(ar);
|
|
||||||
} else if (this.stretch.mode == StretchMode.CONDITIONAL) {
|
|
||||||
this.stretcher.conditionalStretch(zoomFactors, ar);
|
|
||||||
}
|
|
||||||
// this.zoom.applyZoom(dimensions);
|
|
||||||
|
|
||||||
var cssOffsets = this.computeOffsets(dimensions);
|
|
||||||
this.applyCss(cssOffsets, stretchFactors);
|
this.applyCss(cssOffsets, stretchFactors);
|
||||||
|
|
||||||
if(! this.destroyed)
|
// if(! this.destroyed)
|
||||||
this.startCssWatcher();
|
// this.startCssWatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
setLastAr(override){
|
setLastAr(override){
|
||||||
|
@ -57,7 +57,7 @@ class Zoom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
applyZoom(videoDimensions){
|
applyZoom(videoDimensions){
|
||||||
videoDimensions.width *= this.scale;
|
videoDimensions.xFactor *= this.scale;
|
||||||
videoDimensions.height *= this.scale;
|
videoDimensions.yFactor *= this.scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user