mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 09:41:20 -08:00
删除多余事件
This commit is contained in:
1 parent
e0faa3fe68
commit
7ff61b4660
38 files changed
+266
-516
No files matched your search
@@ -1,22 +0,0 @@
|
||||
import { debounce } from '../utils';
|
||||
|
||||
export default function autoPip(art) {
|
||||
const { events, player, template } = art;
|
||||
|
||||
const scrollDebounce = debounce(() => {
|
||||
const { top, height } = template.$player.getBoundingClientRect();
|
||||
if (top + height <= 0 && !player.pip) {
|
||||
player.pip = true;
|
||||
art.emit('autoPip', true);
|
||||
} else if (player.pip) {
|
||||
player.pip = false;
|
||||
art.emit('autoPip', false);
|
||||
}
|
||||
}, 300);
|
||||
|
||||
events.proxy(window, 'scroll', scrollDebounce);
|
||||
|
||||
return {
|
||||
name: 'autoPip',
|
||||
};
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import localVideo from './localVideo';
|
||||
import localSubtitle from './localSubtitle';
|
||||
import miniProgressBar from './miniProgressBar';
|
||||
import networkMonitor from './networkMonitor';
|
||||
import autoPip from './autoPip';
|
||||
|
||||
export default class Plugins {
|
||||
constructor(art) {
|
||||
@@ -33,10 +32,6 @@ export default class Plugins {
|
||||
this.add(networkMonitor);
|
||||
}
|
||||
|
||||
if (option.autoPip) {
|
||||
this.add(autoPip);
|
||||
}
|
||||
|
||||
art.option.plugins.forEach(plugin => {
|
||||
this.add(plugin);
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import { query } from '../utils';
|
||||
function settingMix(art) {
|
||||
const {
|
||||
i18n,
|
||||
plugins,
|
||||
subtitle,
|
||||
events: { proxy },
|
||||
} = art;
|
||||
@@ -25,7 +26,7 @@ function settingMix(art) {
|
||||
proxy($range, 'change', () => {
|
||||
const { value } = $range;
|
||||
$value.innerText = value;
|
||||
art.plugins.subtitleOffset.offset(Number(value));
|
||||
plugins.subtitleOffset.offset(Number(value));
|
||||
});
|
||||
|
||||
art.on('subtitle:switch', () => {
|
||||
|
||||
Reference in new issue
Block a user