remove floatCeil

This commit is contained in:
Harvey committed 2019-09-12 17:41:20 +08:00
1 parent a244879a3e
commit 9be587559f
4 files changed
+6 -15

No files matched your search

+3 -3
View File
@@ -1,4 +1,4 @@
import { setStyle, floatCeil } from '../utils';
import { setStyle } 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 = floatCeil(((height * videoRatio) / width) * 100, 1);
const percentage = ((height * videoRatio) / width) * 100;
setStyle($player, 'width', `${percentage}%`);
setStyle($player, 'height', '100%');
} else {
const percentage = floatCeil((width / videoRatio / height) * 100, 1);
const percentage = (width / videoRatio / height) * 100;
setStyle($player, 'width', '100%');
setStyle($player, 'height', `${percentage}%`);
}
-4
View File
@@ -15,10 +15,6 @@ export function clamp(num, a, b) {
return Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b));
}
export function floatCeil(num, precision = 2) {
return Math.ceil(num * 10 ** precision) / 10 ** precision;
}
export function getExt(url) {
if (url.includes('?')) {
return getExt(url.split('?')[0]);