From afaf65a53dfda150b4b23e6320f2966b88dffd87 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 2 Nov 2021 22:19:50 +0100 Subject: [PATCH] Fix stretch mode from ui --- src/ext/lib/video-transform/Resizer.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ext/lib/video-transform/Resizer.ts b/src/ext/lib/video-transform/Resizer.ts index 3144dab..b6f6156 100644 --- a/src/ext/lib/video-transform/Resizer.ts +++ b/src/ext/lib/video-transform/Resizer.ts @@ -70,7 +70,7 @@ class Resizer { 'set-stretch': [{ function: (config: any) => { this.manualZoom = false; // we also need to unset manual aspect ratio when doing this - this.setStretchMode(config.stretchMode, config.fixedAspectRatio) + this.setStretchMode(config.type, config.ratio) } }], 'set-zoom': [{ @@ -324,8 +324,13 @@ class Resizer { stretchFactors = this.stretcher.calculateBasicStretch(); this.logger.log('info', 'debug', '[Resizer::setAr] Processed stretch factors for basic StretchType. Stretch factors are:', stretchFactors); } else { - stretchFactors = {xFactor: 1, yFactor: 1}; - this.logger.log('error', 'debug', '[Resizer::setAr] Okay wtf happened? If you see this, something has gone wrong', stretchFactors,"\n------[ i n f o d u m p ]------\nstretcher:", this.stretcher); + stretchFactors = this.scaler.calculateCrop(ar); + this.logger.log( + 'error', 'debug', + '[Resizer::setAr] Okay wtf happened? If you see this, something has gone wrong. Pretending stretchMode is set tu NoStretch. Stretch factors are:', stretchFactors, + "\n------[ i n f o d u m p ]------\nstretcher:", this.stretcher, + '\nargs: ar (corrected for legacy):', ar, 'last ar (optional argument):', lastAr + ); } this.applyScaling(stretchFactors);