Skip to content

Commit

Permalink
set minimum video size
Browse files Browse the repository at this point in the history
  • Loading branch information
Krazete committed Jun 5, 2023
1 parent 75d715a commit 85d92cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ytscroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function videoAnchor() {
document.getElementById("primary")
);
var commentRect = comment.getBoundingClientRect();
var minRatio = 320 / videoRect.width;
var widthRatio = (window.innerWidth - commentRect.right) / videoRect.width;
var heightRatio = window.innerHeight / videoRect.height;
player.style.position = "fixed";
Expand All @@ -26,7 +27,7 @@ function videoAnchor() {
player.style.width = videoRect.width + "px";
player.style.height = videoRect.height + "px";
player.style.transformOrigin = "right top";
player.style.transform = "scale(" + Math.min(widthRatio, heightRatio) + ")";
player.style.transform = "scale(" + Math.max(minRatio, Math.min(widthRatio, heightRatio)) + ")";
player.style.zIndex = "1500";
control.style.left = "12px";
control.style.width = (videoRect.width - 24) + "px";
Expand Down

0 comments on commit 85d92cd

Please sign in to comment.