Various fixes. Release version for reals

This commit is contained in:
Tamius Han 2018-09-23 02:39:27 +02:00
parent e2cb85610b
commit 79f5ae01de
6 changed files with 27 additions and 11 deletions

View File

@ -63,8 +63,8 @@ class CommsClient {
if (message.cmd === "set-ar") {
this.pageInfo.setAr(message.ratio);
} else if (message.cmd === 'set-video-float') {
this.pageInfo.setVideoFloat(message.newFloat);
} else if (message.cmd === 'set-alignment') {
this.pageInfo.setVideoFloat(message.mode);
this.pageInfo.restoreAr();
} else if (message.cmd === "set-stretch") {
this.pageInfo.setStretchMode(StretchMode[message.mode]);
@ -276,7 +276,7 @@ class CommsServer {
} else if (message.cmd === 'set-custom-ar') {
this.settings.active.keyboard.shortcuts.q.arg = message.ratio;
this.settings.save();
} else if (message.cmd === 'set-video-float') {
} else if (message.cmd === 'set-alignment') {
this.sendToActive(message);
} else if (message.cmd === 'autoar-start') {
this.sendToActive(message);

View File

@ -123,6 +123,10 @@ class VideoData {
this.resizer.setPanMode(mode);
}
setVideoFloat(videoFloat) {
this.resizer.setVideoFloat(videoFloat);
}
restoreAr(){
this.resizer.restore();
}

View File

@ -476,13 +476,14 @@ class ArDetector {
var newCanvasWidth = window.innerHeight * (this.video.videoWidth / this.video.videoHeight);
var newCanvasHeight = window.innerHeight;
if(this.resizer.videFloat === "center")
if (this.conf.resizer.videoFloat === "center") {
this.canvasDrawWindowHOffset = Math.round((window.innerWidth - newCanvasWidth) * 0.5);
else if(this.resizer.videFloat == "left")
} else if (this.conf.resizer.videoFloat == "left") {
this.canvasDrawWindowHOffset = 0;
else
} else {
this.canvasDrawWindowHOffset = window.innerWidth - newCanvasWidth;
}
this.setup(newCanvasWidth, newCanvasHeight);
return;

View File

@ -235,6 +235,12 @@ class PageInfo {
}
}
setVideoFloat(videoFloat) {
for(var vd of this.videos) {
vd.setVideoFloat(videoFloat)
}
}
setPanMode(mode) {
for(var vd of this.videos) {
vd.setPanMode(mode);

View File

@ -180,6 +180,11 @@ class Resizer {
this.restore();
}
setVideoFloat(videoFloat) {
this.videoFloat = videoFloat;
this.restore();
}
startCssWatcher(){
if (this.destroyed) {
return;

View File

@ -738,11 +738,11 @@ document.addEventListener("click", (e) => {
if (e.target.classList.contains("_align")) {
command.cmd = "set-alignment";
if (e.target.classList.contains("_align_left")) {
if (e.target.classList.contains("_align_video_left")) {
command.mode = 'left';
} else if (e.target.classList.contains("_align_center")) {
} else if (e.target.classList.contains("_align_video_center")) {
command.mode = 'center';
} else if (e.target.classList.contains("_align_right")) {
} else if (e.target.classList.contains("_align_video_right")) {
command.mode = 'right';
}
@ -767,7 +767,7 @@ document.addEventListener("click", (e) => {
VideoPanel.inputs.zoomSlider.value = 0; // log₂(1)
command.cmd = 'set-zoom';
command.zoom = 1;
return;
return command;
}
//#endregion
//#region show/hide custom ar