conditional stretching

This commit is contained in:
Tamius Han 2018-05-07 21:58:11 +02:00
parent 390348202e
commit c7b6035c55
2 changed files with 44 additions and 4 deletions

View File

@ -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;
}
}

View File

@ -288,7 +288,7 @@
<li>Email: <a href="mailto:tamius.han@gmail.com?subject=%5BUltrawidify%5D+ENTER+SUMMARY+OF+YOUR+ISSUE+HERE&body=Describe+your+issue+in+more+detail.+Don%27t+forget+to+include%3A%0D%0A%2A+Extension+version%0D%0A%2A+Browser%0D%0A%2A+Operating+system%0D%0A%2A+Other+extensions+that+could+possibly+interfere%0D%0A%0D%0AIf+you%27re+reporting+an+issue+with+automatic+aspect+ratio+detection%2C+please+also+include+the+following+%28if+possible%29%3A%0D%0A%2A+model+and+make+of+your+CPU%0D%0A%2A+amount+of+RAM">tamius.han@gmail.com</a></li>
</ul>
<div>
<p>When reporting an issue, don't forget to include some detail. <b>Don't forget to mention your <u><i>BROWSER</i></u></b> (Firefox or Chrome), browser version, and <b>extension version</b> (see above).</p>
<p>When reporting an issue, don't forget to include some details. <b>Don't forget to mention your <u><i>BROWSER</i></u></b> (Firefox or Chrome), browser version, and <b>extension version</b> (see above).</p>
<p>Please DON'T just say "dont work pls fix"</p>
<p>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.</p></div>
</div>