From c6e3689d0dc3cafdc760442ba75df2cf07e8eb75 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 16 Nov 2018 23:02:56 +0100 Subject: [PATCH] Fixed video alignment --- js/modules/Resizer.js | 18 +++++++++--------- js/uw.js | 4 ++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/js/modules/Resizer.js b/js/modules/Resizer.js index 00f110f..992575b 100644 --- a/js/modules/Resizer.js +++ b/js/modules/Resizer.js @@ -309,13 +309,13 @@ if(Debug.debug) console.log("[Resizer::_res_computeOffsets] video will be aligned to ", this.settings.active.miscFullscreenSettings.videoFloat); } - var actualWidth = this.conf.video.offsetWidth * stretchFactors.xFactor; - var actualHeight = this.conf.video.offsetHeight * stretchFactors.yFactor; + var wdiff = this.conf.player.dimensions.width - this.conf.video.offsetWidth; + var hdiff = this.conf.player.dimensions.height - this.conf.video.offsetHeight; - var wdiff = actualWidth - this.conf.player.dimensions.width; - var hdiff = actualHeight - this.conf.player.dimensions.height; - - var translate = {x: 0, y: 0}; + var translate = { + x: wdiff * 0.5, + y: hdiff * 0.5, + }; if (this.pan) { // don't offset when video is smaller than player @@ -326,10 +326,10 @@ if(Debug.debug) translate.y = hdiff * this.pan.relativeOffsetY / this.zoom.scale; } else { if (this.videoFloat == "left") { - translate.x = wdiff * 0.5; + translate.x = 0; } else if (this.videoFloat == "right") { - translate.x = wdiff * -0.5; + translate.x = wdiff; } } @@ -386,7 +386,7 @@ if(Debug.debug) // add remaining elements if(stretchFactors){ - styleArray.push(`transform: scale(${stretchFactors.xFactor}, ${stretchFactors.yFactor}) translate(${translate.x}px, ${translate.y}px)`); + styleArray.push(`transform: translate(${translate.x}px, ${translate.y}px) scale(${stretchFactors.xFactor}, ${stretchFactors.yFactor})`); styleArray.push("top: 0px; left: 0px; bottom: 0px; right: 0px"); } diff --git a/js/uw.js b/js/uw.js index c05ff76..f4b3185 100644 --- a/js/uw.js +++ b/js/uw.js @@ -78,6 +78,10 @@ class UW { this.actionHandler = new ActionHandler(this.pageInfo); this.actionHandler.init(); + if(Debug.debug) { + console.log("[uw.js::setup] ActionHandler initiated:", this.actionHandler); + } + } catch (e) { console.log("[uw::init] FAILED TO START EXTENSION. Error:", e); }