Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zhw2590582 committed May 13, 2023
1 parent f26db31 commit 7bb6af0
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 31 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [5.0.8] - 2023-5-13

- 修复 `art.mini` 的互斥关系
- 修复 `art.aspectRatio` 动画效果问题

## [5.0.7] - 2023-5-13

- 使用 `switchUrl` 或者 `switchQuality` 方法切换地址后会保持原有的调整如:`aspectRatio`, `playbackRate`, `flip`, `autoSize`
Expand Down
4 changes: 2 additions & 2 deletions docs/compiled/artplayer.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/compiled/artplayer.legacy.js

Large diffs are not rendered by default.

23 changes: 11 additions & 12 deletions docs/uncompiled/artplayer/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/uncompiled/artplayer/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/artplayer/dist/artplayer.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/artplayer/dist/artplayer.legacy.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/artplayer/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"license": "MIT",
"name": "artplayer",
"version": "5.0.7",
"version": "5.0.8",
"main": "dist/artplayer.js",
"legacy": "dist/artplayer.legacy.js",
"types": "types/artplayer.d.ts",
Expand Down
14 changes: 6 additions & 8 deletions packages/artplayer/src/player/aspectRatioMix.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setStyle, def, clamp } from '../utils';
import { setStyle, def } from '../utils';

export default function aspectRatioMix(art) {
const {
Expand All @@ -16,7 +16,7 @@ export default function aspectRatioMix(art) {
if (ratio === 'default') {
setStyle($video, 'width', null);
setStyle($video, 'height', null);
setStyle($video, 'padding', null);
setStyle($video, 'margin', null);
delete $player.dataset.aspectRatio;
} else {
const ratioArray = ratio.split(':').map(Number);
Expand All @@ -25,15 +25,13 @@ export default function aspectRatioMix(art) {
const setupRatio = ratioArray[0] / ratioArray[1];

if (playerRatio > setupRatio) {
const width = clamp(setupRatio * clientHeight, 0, clientWidth);
setStyle($video, 'width', `${width}px`);
setStyle($video, 'width', `${setupRatio * clientHeight}px`);
setStyle($video, 'height', '100%');
setStyle($video, 'padding', `0 ${(clientWidth - width) / 2}px`);
setStyle($video, 'margin', '0 auto');
} else {
const height = clamp(clientWidth / setupRatio, 0, clientHeight);
setStyle($video, 'width', '100%');
setStyle($video, 'height', `${height}px`);
setStyle($video, 'padding', `${(clientHeight - height) / 2}px 0`);
setStyle($video, 'height', `${clientWidth / setupRatio}px`);
setStyle($video, 'margin', 'auto 0');
}

$player.dataset.aspectRatio = ratio;
Expand Down
1 change: 0 additions & 1 deletion packages/artplayer/src/style/aspectRatio.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
.art-video {
object-fit: fill;
box-sizing: content-box;
transition: all var(--art-transition-duration) ease;
}
}
}

0 comments on commit 7bb6af0

Please sign in to comment.