mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
feat: Add getRect function to utils and update player and control modules to use it
This commit is contained in:
1 parent
2721f61b41
commit
232b8a3e17
10 files changed
+36
-27
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { setStyle, def } from '../utils';
|
||||
import { setStyle, def, getRect } from '../utils';
|
||||
|
||||
export default function resizeMix(art) {
|
||||
const { $container, $player, $video } = art.template;
|
||||
@@ -6,7 +6,7 @@ export default function resizeMix(art) {
|
||||
def(art, 'autoSize', {
|
||||
value() {
|
||||
const { videoWidth, videoHeight } = $video;
|
||||
const { width, height } = $container.getBoundingClientRect();
|
||||
const { width, height } = getRect($container);
|
||||
const videoRatio = videoWidth / videoHeight;
|
||||
const containerRatio = width / height;
|
||||
if (containerRatio > videoRatio) {
|
||||
|
||||
Reference in new issue
Block a user