Fixed cropping via popup
This commit is contained in:
parent
c9f806cd5f
commit
d51ce8add7
@ -8,7 +8,7 @@ var Debug = {
|
||||
debug: true,
|
||||
// debug: false,
|
||||
keyboard: true,
|
||||
// debugResizer: true,
|
||||
debugResizer: true,
|
||||
// debugArDetect: true,
|
||||
// debugStorage: false,
|
||||
// debugStorage: true,
|
||||
|
@ -75,7 +75,7 @@ class Resizer {
|
||||
calculateRatioForLegacyOptions(ar){
|
||||
// also present as modeToAr in Scaler.js
|
||||
if (ar.ratio) {
|
||||
return ar.ratio;
|
||||
return ar;
|
||||
}
|
||||
// Skrbi za "stare" možnosti, kot na primer "na širino zaslona", "na višino zaslona" in "ponastavi".
|
||||
// Približevanje opuščeno.
|
||||
@ -93,8 +93,7 @@ class Resizer {
|
||||
|
||||
if (! this.conf.player.dimensions) {
|
||||
ratioOut = screen.width / screen.height;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ratioOut = this.conf.player.dimensions.width / this.conf.player.dimensions.height;
|
||||
}
|
||||
|
||||
@ -107,24 +106,21 @@ class Resizer {
|
||||
var fileAr = this.conf.video.videoWidth / this.conf.video.videoHeight;
|
||||
|
||||
if (ar.type === AspectRatio.FitWidth){
|
||||
ratioOut > fileAr ? ratioOut : fileAr
|
||||
ar.ratio = ratioOut;
|
||||
return ratioOut;
|
||||
ar.ratio = ratioOut > fileAr ? ratioOut : fileAr;
|
||||
}
|
||||
else if(ar.type === AspectRatio.FitHeight){
|
||||
ratioOut < fileAr ? ratioOut : fileAr
|
||||
ar.ratio = ratioOut;
|
||||
return ratioOut;
|
||||
ar.ratio = ratioOut < fileAr ? ratioOut : fileAr;
|
||||
}
|
||||
else if(ar.type === AspectRatio.Reset){
|
||||
if(Debug.debug){
|
||||
console.log("[Scaler.js::modeToAr] Using original aspect ratio -", fileAr)
|
||||
console.log("[Scaler.js::modeToAr] Using original aspect ratio -", fileAr);
|
||||
}
|
||||
ar.ar = fileAr;
|
||||
return fileAr;
|
||||
ar.ratio = fileAr;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
@ -144,14 +140,16 @@ class Resizer {
|
||||
if (lastAr) {
|
||||
this.lastAr = lastAr;
|
||||
} else {
|
||||
if(isNaN(ar)){
|
||||
// NOTE: "fitw" "fith" and "reset" should ignore ar.ratio bit, but
|
||||
// I'm not sure whether they do. Check that.
|
||||
this.lastAr = {type: ar.type, ratio: ar.ratio}
|
||||
this.calculateRatioForLegacyOptions(ar);
|
||||
} else {
|
||||
throw 'Ar was passed as a number rather than an object. You missed one.'
|
||||
ar = this.calculateRatioForLegacyOptions(ar);
|
||||
if (! ar) {
|
||||
if (Debug.debug && Debug.debugResizer) {
|
||||
console.log(`[Resizer::setAr] <${this.resizerId}> Something wrong with ar or the player. Doing nothing.`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.lastAr = {type: ar.type, ratio: ar.ratio}
|
||||
}
|
||||
|
||||
if (this.extensionMode === ExtensionMode.Basic && !PlayerData.isFullScreen() && ar.type !== AspectRatio.Reset) {
|
||||
|
@ -76,25 +76,19 @@ class Scaler {
|
||||
return {error: "no_video"};
|
||||
}
|
||||
|
||||
|
||||
// če je 'ar' string, potem bomo z njim opravili v legacy wrapperju. Seveda obstaja izjema
|
||||
// if 'ar' is string, we'll handle that in legacy wrapper, with one exception
|
||||
|
||||
if (ar.type === AspectRatio.Reset){
|
||||
return {xFactor: 1, yFactor: 1}
|
||||
}
|
||||
|
||||
var ratio = this.modeToAr(ar);
|
||||
|
||||
// handle fuckie-wuckies
|
||||
if (! ratio){
|
||||
if (! ar.ratio){
|
||||
if(Debug.debug)
|
||||
console.log("[Scaler::calculateCrop] no ar?", ratio, " -- we were given this mode:", ar);
|
||||
return {error: "no_ar", ratio: ratio};
|
||||
console.log("[Scaler::calculateCrop] no ar?", ar.ratio, " -- we were given this mode:", ar);
|
||||
return {error: "no_ar", ratio: ar.ratio};
|
||||
}
|
||||
|
||||
if(Debug.debug)
|
||||
console.log("[Scaler::calculateCrop] trying to set ar. args are: ar->",ratio,"; this.conf.player.dimensions->",this.conf.player.dimensions.width, "×", this.conf.player.dimensions.height, "| obj:", this.conf.player.dimensions);
|
||||
console.log("[Scaler::calculateCrop] trying to set ar. args are: ar->",ar.ratio,"; this.conf.player.dimensions->",this.conf.player.dimensions.width, "×", this.conf.player.dimensions.height, "| obj:", this.conf.player.dimensions);
|
||||
|
||||
if( (! this.conf.player.dimensions) || this.conf.player.dimensions.width === 0 || this.conf.player.dimensions.height === 0 ){
|
||||
if(Debug.debug)
|
||||
@ -110,12 +104,12 @@ class Scaler {
|
||||
var fileAr = this.conf.video.videoWidth / this.conf.video.videoHeight;
|
||||
var playerAr = this.conf.player.dimensions.width / this.conf.player.dimensions.height;
|
||||
|
||||
if(ar.type == AspectRatio.Initial || !ratio)
|
||||
ratio = fileAr;
|
||||
if(ar.type === AspectRatio.Initial || !ar.ratio)
|
||||
ar.ratio = fileAr;
|
||||
|
||||
|
||||
if(Debug.debug)
|
||||
console.log("[Scaler::calculateCrop] ar is " ,ratio, ", file ar is", fileAr, ", this.conf.player.dimensions are ", this.conf.player.dimensions.width, "×", this.conf.player.dimensions.height, "| obj:", this.conf.player.dimensions);
|
||||
console.log("[Scaler::calculateCrop] ar is " ,ar.ratio, ", file ar is", fileAr, ", this.conf.player.dimensions are ", this.conf.player.dimensions.width, "×", this.conf.player.dimensions.height, "| obj:", this.conf.player.dimensions);
|
||||
|
||||
var videoDimensions = {
|
||||
xFactor: 1,
|
||||
@ -128,15 +122,15 @@ class Scaler {
|
||||
// console.log("[Scaler::calculateCrop] Player dimensions?", this.conf.player.dimensions.width, "×", this.conf.player.dimensions.height, "| obj:", this.conf.player.dimensions);
|
||||
// }
|
||||
|
||||
if( fileAr < ratio ){
|
||||
if( fileAr < ar.ratio ){
|
||||
// imamo letterbox zgoraj in spodaj -> spremenimo velikost videa (a nikoli širše od ekrana)
|
||||
// letterbox -> change video size (but never to wider than monitor width)
|
||||
|
||||
videoDimensions.xFactor = Math.min(ratio, playerAr) / fileAr;
|
||||
videoDimensions.xFactor = Math.min(ar.ratio, playerAr) / fileAr;
|
||||
videoDimensions.yFactor = videoDimensions.xFactor;
|
||||
}
|
||||
else {
|
||||
videoDimensions.xFactor = fileAr / Math.min(ratio, playerAr);
|
||||
videoDimensions.xFactor = fileAr / Math.min(ar.ratio, playerAr);
|
||||
videoDimensions.yFactor = videoDimensions.xFactor;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,8 @@ class ExecAction {
|
||||
targetFrame: frame,
|
||||
frame: frame,
|
||||
cmd: cmd.action,
|
||||
arg: cmd.arg
|
||||
arg: cmd.arg,
|
||||
customArg: cmd.customArg
|
||||
}
|
||||
Comms.sendMessage(message);
|
||||
} else if (scope === 'site') {
|
||||
|
Loading…
Reference in New Issue
Block a user