mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 05:11:20 -08:00
add floatCeil
This commit is contained in:
1 parent
18ca81e2ed
commit
a244879a3e
4 files changed
+15
-6
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { setStyle } from '../utils';
|
||||
import { setStyle, floatCeil } from '../utils';
|
||||
|
||||
export default function resizeMix(art, player) {
|
||||
const {
|
||||
@@ -17,11 +17,11 @@ export default function resizeMix(art, player) {
|
||||
const containerRatio = width / height;
|
||||
$container.classList.add('artplayer-auto-size');
|
||||
if (containerRatio > videoRatio) {
|
||||
const percentage = ((height * videoRatio) / width) * 100;
|
||||
const percentage = floatCeil(((height * videoRatio) / width) * 100, 1);
|
||||
setStyle($player, 'width', `${percentage}%`);
|
||||
setStyle($player, 'height', '100%');
|
||||
} else {
|
||||
const percentage = (width / videoRatio / height) * 100;
|
||||
const percentage = floatCeil((width / videoRatio / height) * 100, 1);
|
||||
setStyle($player, 'width', '100%');
|
||||
setStyle($player, 'height', `${percentage}%`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user