"Fit to width" and "fit to height" now calculate video fit according to player size, not screen size.

This commit is contained in:
Tamius Han 2018-01-27 20:27:11 +01:00
parent 463dcc0692
commit 0c1cae3215
2 changed files with 11 additions and 8 deletions

View File

@ -182,7 +182,15 @@ var _res_reset = function(force){
// handles "legacy" options, such as 'fit to widht', 'fit to height' and 'reset'. No zoom tho
var _res_legacyAr = function(action){
var vid = GlobalVars.video;
var ar = screen.width / screen.height;
var ar;
if(GlobalVars.playerDimensions === null || GlobalVars.playerDimensions === undefined){
ar = screen.width / screen.height;
}
else{
ar = GlobalVars.playerDimensions.width / GlobalVars.playerDimensions.height;
}
var fileAr = vid.videoWidth / vid.videoHeight;
if(action == "fitw"){

View File

@ -101,12 +101,7 @@ function ghettoOnChange(){
var video = document.getElementsByTagName("video")[0];
if(video !== undefined){
GlobalVars.video = video;
// try{
Comms.sendToBackgroundScript({"cmd":"register-video"});
// }
// catch(chromeIsShitError){
// cos firefox won't crap its bed if a promise comes back unfulfilled
Comms.sendToBackgroundScript({"cmd":"register-video"});
}
}
}
@ -123,7 +118,7 @@ function ghettoOnChange(){
if (newPlayerDims == undefined)
return;
GlobalVars.playerDimeimensions = newPlayerDims;
GlobalVars.playerDimensions = newPlayerDims;
if ( newPlayerDims.width != _player_dimensions_last.width ||
newPlayerDims.height != _player_dimensions_last.height){