mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 20:21:20 -08:00
remove player object
This commit is contained in:
1 parent
59a8ccce81
commit
59400eb3bf
58 files changed
+295
-313
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { inverseClass, queryAll } from '../utils';
|
||||
|
||||
export default function aspectRatio(option) {
|
||||
return art => {
|
||||
const { i18n, player } = art;
|
||||
return (art) => {
|
||||
const { i18n } = art;
|
||||
return {
|
||||
...option,
|
||||
html: `
|
||||
@@ -19,15 +19,15 @@ export default function aspectRatio(option) {
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
click: (setting, event) => {
|
||||
click: (_, event) => {
|
||||
const { value } = event.target.dataset;
|
||||
if (value) {
|
||||
player.aspectRatio = value;
|
||||
art.aspectRatio = value;
|
||||
}
|
||||
},
|
||||
mounted: $setting => {
|
||||
art.on('aspectRatio', ratio => {
|
||||
const $current = queryAll('button', $setting).find(item => item.dataset.value === ratio);
|
||||
mounted: ($setting) => {
|
||||
art.on('aspectRatio', (ratio) => {
|
||||
const $current = queryAll('button', $setting).find((item) => item.dataset.value === ratio);
|
||||
if ($current) {
|
||||
inverseClass($current.parentElement, 'current');
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { inverseClass, queryAll } from '../utils';
|
||||
|
||||
export default function flip(option) {
|
||||
return art => {
|
||||
const { i18n, player } = art;
|
||||
return (art) => {
|
||||
const { i18n } = art;
|
||||
return {
|
||||
...option,
|
||||
html: `
|
||||
@@ -19,15 +19,15 @@ export default function flip(option) {
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
click: (setting, event) => {
|
||||
click: (_, event) => {
|
||||
const { value } = event.target.dataset;
|
||||
if (value) {
|
||||
player.flip = value;
|
||||
art.flip = value;
|
||||
}
|
||||
},
|
||||
mounted: $setting => {
|
||||
art.on('flip', flip => {
|
||||
const $current = queryAll('button', $setting).find(item => item.dataset.value === flip);
|
||||
mounted: ($setting) => {
|
||||
art.on('flip', (flip) => {
|
||||
const $current = queryAll('button', $setting).find((item) => item.dataset.value === flip);
|
||||
if ($current) {
|
||||
inverseClass($current.parentElement, 'current');
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { query } from '../utils';
|
||||
|
||||
export default function playbackRate(option) {
|
||||
return art => {
|
||||
return (art) => {
|
||||
const {
|
||||
i18n,
|
||||
player,
|
||||
events: { proxy },
|
||||
} = art;
|
||||
return {
|
||||
@@ -17,16 +16,16 @@ export default function playbackRate(option) {
|
||||
<input class="art-subtitle-range" value="1" type="range" min="0.5" max="2" step="0.25">
|
||||
</div>
|
||||
`,
|
||||
mounted: $setting => {
|
||||
mounted: ($setting) => {
|
||||
const $range = query('.art-setting-range input', $setting);
|
||||
const $value = query('.art-subtitle-value', $setting);
|
||||
proxy($range, 'change', () => {
|
||||
const { value } = $range;
|
||||
$value.innerText = value;
|
||||
player.playbackRate = Number(value);
|
||||
art.playbackRate = Number(value);
|
||||
});
|
||||
|
||||
art.on('playbackRate', rate => {
|
||||
art.on('playbackRate', (rate) => {
|
||||
if (rate && $range.value !== rate) {
|
||||
$range.value = rate;
|
||||
$value.innerText = rate;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { query } from '../utils';
|
||||
|
||||
export default function rotate(option) {
|
||||
return (art) => {
|
||||
const { i18n, player } = art;
|
||||
const { i18n } = art;
|
||||
return {
|
||||
...option,
|
||||
html: `
|
||||
@@ -21,14 +21,14 @@ export default function rotate(option) {
|
||||
click: (setting, event) => {
|
||||
const { value } = event.target.dataset;
|
||||
if (value) {
|
||||
const deg = player.rotate + Number(value);
|
||||
const deg = art.rotate + Number(value);
|
||||
if (deg === 360 || deg === -360) {
|
||||
player.rotate = 0;
|
||||
art.rotate = 0;
|
||||
} else {
|
||||
player.rotate = deg;
|
||||
art.rotate = deg;
|
||||
}
|
||||
} else {
|
||||
player.rotate = 0;
|
||||
art.rotate = 0;
|
||||
}
|
||||
},
|
||||
mounted: ($setting) => {
|
||||
|
||||
Reference in new issue
Block a user