stretch mode is in stretcher now

This commit is contained in:
Tamius Han 2018-05-30 23:20:23 +02:00
parent 9478b5af15
commit 8e1687a5b6
2 changed files with 6 additions and 37 deletions

View File

@ -22,7 +22,6 @@ class Resizer {
// load up default values
this.correctedVideoDimensions = {};
this.currentCss = {};
this.stretch = {mode: ExtensionConf.stretch.initialMode};
// restore watchdog. While true, applyCss() tries to re-apply new css until this value becomes false again
// value becomes false when width and height of <video> tag match with what we want to set. Only necessary when
@ -68,7 +67,7 @@ class Resizer {
}
if (this.stretch.mode === StretchMode.NO_STRETCH || this.stretch.mode === StretchMode.CONDITIONAL){
if (this.stretcher.mode === StretchMode.NO_STRETCH || this.stretcher.mode === StretchMode.CONDITIONAL){
var stretchFactors = this.scaler.calculateCrop(ar);
if(! stretchFactors || stretchFactors.error){
@ -80,10 +79,10 @@ class Resizer {
}
return;
}
if(this.stretch.mode === StretchMode.CONDITIONAL){
if(this.stretcher.mode === StretchMode.CONDITIONAL){
this.stretcher.applyConditionalStretch(stretchFactors, ar);
}
} else if (this.stretch.mode === StretchMode.HYBRID) {
} else if (this.stretcher.mode === StretchMode.HYBRID) {
var stretchFactors = this.stretcher.calculateStretch(ar);
}
@ -106,7 +105,7 @@ class Resizer {
}
setStretchMode(stretchMode){
this.stretch.mode = stretchMode;
this.stretcher.mode = stretchMode;
this.restore();
}
@ -178,7 +177,7 @@ class Resizer {
}
resetStretch(){
this.stretch.mode = StretchMode.NO_STRETCH;
this.stretcher.mode = StretchMode.NO_STRETCH;
this.restore();
}

View File

@ -11,6 +11,7 @@ class Stretcher {
// functions
constructor(videoData) {
this.conf = videoData;
this.mode = ExtensionConf.stretch.initialMode;
}
applyConditionalStretch(stretchFactors, actualAr){
@ -139,37 +140,6 @@ class Stretcher {
}
}
// if (actualAr > videoAr) {
// if(videoAr > playerAr) {
// // actual ar > video ar > player ar
// // stretch to fit player
// // stretchFactors.xFactor = playerAr / videoAr; // is this 1 then?
// stretchFactors.xFactor = 1;
// stretchFactors.yFactor = actualAr / playerAr;
// } else {
// // actual ar > player ar > video ar
// if(Debug.debug){
// console.log("[Stretcher.js::calculateStretch] stretching strategy 2")
// }
// stretchFactors.xFactor = 1; //playerAr / videoAr;
// stretchFactors.yFactor = actualAr / videoAr;
// }
// } else {
// if (videoAr > playerAr) {
// if(Debug.debug){
// console.log("[Stretcher.js::calculateStretch] stretching strategy 3")
// }
// stretchFactors.xFactor = videoAr / actualAr;
// stretchFactors.yFactor = playerAr / actualAr;
// } else {
// if(Debug.debug){
// console.log("[Stretcher.js::calculateStretch] stretching strategy 4")
// }
// stretchFactors.xFactor = playerAr / actualAr;
// stretchFactors.yFactor = 1;
// }
// }
return stretchFactors;
}
}