mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
add moveOnFullscreen to danmuku
This commit is contained in:
1 parent
3b3b469b9b
commit
40b76e1b74
8 files changed
+54
-26
No files matched your search
@@ -25,12 +25,7 @@ export default function setting(art, danmuku) {
|
||||
const $danmuOff = getIcon(danmuOff, 'danmu-off');
|
||||
const $danmuConfig = getIcon(danmuConfig, 'danmu-config');
|
||||
const $danmuStyle = getIcon(danmuStyle, 'danmu-config');
|
||||
|
||||
let $control = $controlsCenter;
|
||||
|
||||
if (option.mount instanceof Element) {
|
||||
$control = option.mount;
|
||||
}
|
||||
const $control = option.mount || $controlsCenter;
|
||||
|
||||
function addEmitter() {
|
||||
const colors = [
|
||||
@@ -131,12 +126,28 @@ export default function setting(art, danmuku) {
|
||||
art.emit('artplayerPluginDanmuku:emit', danmu);
|
||||
}
|
||||
|
||||
function resize() {
|
||||
function onResize() {
|
||||
if (option.minWidth) {
|
||||
setStyle($emitter, 'display', $control.clientWidth < option.minWidth ? 'none' : null);
|
||||
}
|
||||
}
|
||||
|
||||
function onFullscreen(state) {
|
||||
if (option.moveOnFullscreen && $control !== $controlsCenter) {
|
||||
if (state) {
|
||||
append($controlsCenter, $emitter);
|
||||
} else {
|
||||
append($control, $emitter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onDestroy() {
|
||||
if ($control !== $controlsCenter) {
|
||||
$control.removeChild($emitter);
|
||||
}
|
||||
}
|
||||
|
||||
art.proxy($send, 'click', onSend);
|
||||
|
||||
art.proxy($input, 'keypress', (event) => {
|
||||
@@ -162,14 +173,11 @@ export default function setting(art, danmuku) {
|
||||
}
|
||||
});
|
||||
|
||||
resize();
|
||||
art.on('resize', resize);
|
||||
|
||||
art.on('destroy', () => {
|
||||
if ($control !== $controlsCenter) {
|
||||
$control.removeChild($emitter);
|
||||
}
|
||||
});
|
||||
onResize();
|
||||
art.on('resize', onResize);
|
||||
art.on('fullscreen', onFullscreen);
|
||||
art.on('fullscreenWeb', onFullscreen);
|
||||
art.on('destroy', onDestroy);
|
||||
}
|
||||
|
||||
function addControl() {
|
||||
|
||||
Reference in new issue
Block a user