Made extgension remember default stretch mode

This commit is contained in:
Tamius Han 2019-02-16 01:54:41 +01:00
parent 5b9080c1c7
commit 4eba239da9
4 changed files with 24 additions and 14 deletions

View File

@ -5,8 +5,8 @@ const _prod = false;
var Debug = { var Debug = {
performanceMetrics: true, // should not be affected by debug.debug in order to allow benchmarking of the impact logging in console has performanceMetrics: true, // should not be affected by debug.debug in order to allow benchmarking of the impact logging in console has
init: true, init: true,
debug: true, // debug: true,
// debug: false, debug: false,
// keyboard: true, // keyboard: true,
debugResizer: true, debugResizer: true,
debugArDetect: true, debugArDetect: true,

View File

@ -18,7 +18,6 @@ class ArDetector {
this.sampleCols = []; this.sampleCols = [];
// todo: dynamically detect the following two
this.canFallback = true; this.canFallback = true;
this.fallbackMode = false; this.fallbackMode = false;
@ -60,7 +59,7 @@ class ArDetector {
throw "Settings prevent autoar from starting" throw "Settings prevent autoar from starting"
} }
} catch (e) { } catch (e) {
console.log("[ArDetect::init] INITIALIZATION FAILED!\n", e); console.log("%c[ArDetect::init] INITIALIZATION FAILED!\n", _ard_console_stop, e);
} }
} }
@ -72,7 +71,7 @@ class ArDetector {
this.stop(); this.stop();
} }
setup(cwidth, cheight, forceStart){ setup(cwidth, cheight){
if(Debug.debug || Debug.init) { if(Debug.debug || Debug.init) {
console.log("[ArDetect::setup] Starting autodetection setup. arid:", this.arid); console.log("[ArDetect::setup] Starting autodetection setup. arid:", this.arid);
} }
@ -237,7 +236,6 @@ class ArDetector {
// (we are running when _halted is neither true nor undefined) // (we are running when _halted is neither true nor undefined)
if (this._halted === false) { if (this._halted === false) {
this._paused = true; this._paused = true;
// this.conf.resizer.resetLastAr();
} }
} }

View File

@ -23,6 +23,13 @@ class VideoData {
// player dimensions need to be in: // player dimensions need to be in:
// this.player.dimensions // this.player.dimensions
// apply default align and stretch
if (Debug.init) {
console.log("%c[VideoData::ctor] Initial resizer reset!", {background: '#afd', color: '#132'});
}
this.resizer.reset();
this.vdid = (Math.random()*100).toFixed(); this.vdid = (Math.random()*100).toFixed();
if (Debug.init) { if (Debug.init) {
console.log("[VideoData::ctor] Created videoData with vdid", this.vdid,"\nextension mode:", this.extensionMode); console.log("[VideoData::ctor] Created videoData with vdid", this.vdid,"\nextension mode:", this.extensionMode);

View File

@ -37,7 +37,8 @@ class Resizer {
this.cssWatcherIncreasedFrequencyCounter = 0; this.cssWatcherIncreasedFrequencyCounter = 0;
this.lastAr = this.settings.getDefaultAr(); // this is the aspect ratio we start with // this.lastAr = this.settings.getDefaultAr(); // this is the aspect ratio we start with
this.lastAr = {type: 'original'};
this.videoAlignment = this.settings.getDefaultVideoAlignment(); // this is initial video alignment this.videoAlignment = this.settings.getDefaultVideoAlignment(); // this is initial video alignment
this.destroyed = false; this.destroyed = false;
@ -107,6 +108,7 @@ class Resizer {
// // pause AR on basic stretch, unpause when using other mdoes // // pause AR on basic stretch, unpause when using other mdoes
// fir sine reason unpause doesn't unpause. investigate that later // fir sine reason unpause doesn't unpause. investigate that later
try {
if (this.stretcher.mode === StretchMode.Basic) { if (this.stretcher.mode === StretchMode.Basic) {
this.conf.arDetector.pause(); this.conf.arDetector.pause();
} else { } else {
@ -114,6 +116,9 @@ class Resizer {
this.conf.arDetector.unpause(); this.conf.arDetector.unpause();
} }
} }
} catch (e) { // resizer starts before arDetector. this will do nothing but fail if arDetector isn't setup
}
// do stretch thingy // do stretch thingy
if (this.stretcher.mode === StretchMode.NoStretch || this.stretcher.mode === StretchMode.Conditional){ if (this.stretcher.mode === StretchMode.NoStretch || this.stretcher.mode === StretchMode.Conditional){
@ -294,7 +299,7 @@ class Resizer {
} }
reset(){ reset(){
this.setStretchMode(StretchMode.NoStretch); this.setStretchMode(this.settings.active.sites[window.location.hostname] ? this.settings.active.sites[window.location.hostname].stretch : this.settings.active.sites['@global'].stretch);
this.zoom.setZoom(1); this.zoom.setZoom(1);
this.resetPan(); this.resetPan();
this.setAr('reset'); this.setAr('reset');