From c7b6035c55ed8a7cac755c578f2cc2d3c862e93e Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Mon, 7 May 2018 21:58:11 +0200 Subject: [PATCH] conditional stretching --- js/modules/Stretcher.js | 46 ++++++++++++++++++++++++++++++++++++++--- res/popup/popup.html | 2 +- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/js/modules/Stretcher.js b/js/modules/Stretcher.js index 007dd06..da56fd8 100644 --- a/js/modules/Stretcher.js +++ b/js/modules/Stretcher.js @@ -5,11 +5,51 @@ class Stretcher { - // internal variables + // internal variables - // functions - constructor() { + // functions + constructor() { + } + + static conditionalStretch(videoDimensions, maxDifferencePercent){ + // samo razširjamo, nikoli krčimo + // only stretch, no shrink + + var x, y; + + x = videoDimensions.width / videoDimensions.actualWidth; + y = videoDimensions.height / videoDimensions.actualHeight; + + var dmax = 1 + maxDifferencePercent; + + if(x < 1 || x > dmax){ + x = 1; } + if(y < 1 || y > dmax){ + y = 1; + } + + return { + x: x, + y: y + } + } + + static calculateStretch(videoDimensions) { + // naj ponovim: samo razširjamo, nikoli krčimo + // let me reiterate: only stretch, no shrink + + var stretch = {x: 1, y: 1}; + + if (videoDimensions.actualWidth < videoDimensions.width) { + stretch.x = videoDimensions.width / videoDimensions.actualWidth; + } + if (videoDimensions.actualHeight < videoDimensions.height){ + stretch.y = videoDimensions.height / videoDimensions.actualHeight; + } + + return stretch; + } } \ No newline at end of file diff --git a/res/popup/popup.html b/res/popup/popup.html index b237625..a5f357e 100644 --- a/res/popup/popup.html +++ b/res/popup/popup.html @@ -288,7 +288,7 @@
  • Email: tamius.han@gmail.com
  • -

    When reporting an issue, don't forget to include some detail. Don't forget to mention your BROWSER (Firefox or Chrome), browser version, and extension version (see above).

    +

    When reporting an issue, don't forget to include some details. Don't forget to mention your BROWSER (Firefox or Chrome), browser version, and extension version (see above).

    Please DON'T just say "dont work pls fix"

    Please DO Provide some information about the issue. Briefly describe what did you do to make the issue appear. If issue only happens with certain videos, include links to problematic videos.