handle alignment along y

This commit is contained in:
Tamius Han 2021-11-03 00:08:34 +01:00
parent 0e3b962a00
commit 75cc0d5a87

View File

@ -64,7 +64,7 @@ class Resizer {
}],
'set-alignment': [{
function: (config: any) => {
this.setVideoAlignment(config.videoAlignmentX, config.videoAlignmentY);
this.setVideoAlignment(config.x, config.y);
}
}],
'set-stretch': [{
@ -399,7 +399,7 @@ class Resizer {
resetPan() {
this.pan = {x: 0, y: 0};
this.videoAlignment = {x: this.settings.getDefaultVideoAlignment(window.location.hostname), y: VideoAlignmentType.Center};
// this.videoAlignment = {x: this.settings.getDefaultVideoAlignment(window.location.hostname), y: VideoAlignmentType.Center};
}
setPan(relativeMousePosX, relativeMousePosY){
@ -624,12 +624,19 @@ class Resizer {
translate.y += hdiffAfterZoom * this.pan.relativeOffsetY * this.zoom.scale;
}
} else {
// correct horizontal alignment according to the settings
if (this.videoAlignment.x == VideoAlignmentType.Left) {
translate.x += wdiffAfterZoom * 0.5;
}
else if (this.videoAlignment.x == VideoAlignmentType.Right) {
} else if (this.videoAlignment.x == VideoAlignmentType.Right) {
translate.x -= wdiffAfterZoom * 0.5;
}
// correct vertical alignment according to the settings
if (this.videoAlignment.y == VideoAlignmentType.Top) {
translate.y += hdiffAfterZoom * 0.5;
} else if (this.videoAlignment.y == VideoAlignmentType.Bottom) {
translate.y -= hdiffAfterZoom * 0.5;
}
}
this.logger.log(