From 9c61232f3011bfe3682913230b67919dfb7b995c Mon Sep 17 00:00:00 2001 From: Ruslan Zakharov Date: Tue, 3 Oct 2023 12:11:20 +0400 Subject: [PATCH] feat: Add skipAspectRatioCheck --- src/subtitles-octopus.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/subtitles-octopus.js b/src/subtitles-octopus.js index 0bf73c14..95b6ec56 100644 --- a/src/subtitles-octopus.js +++ b/src/subtitles-octopus.js @@ -245,9 +245,10 @@ var SubtitlesOctopus = function (options) { var width = self.video.offsetWidth, height = self.video.offsetHeight; var elementRatio = width / height; var realWidth = width, realHeight = height; - if (elementRatio > videoRatio) realWidth = Math.floor(height * videoRatio); - else realHeight = Math.floor(width / videoRatio); - + if(!options.skipAspectRatioCheck) { + if (elementRatio > videoRatio) realWidth = Math.floor(height * videoRatio); + else realHeight = Math.floor(width / videoRatio); + } var x = (width - realWidth) / 2; var y = (height - realHeight) / 2;