mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 04:31: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
@@ -241,7 +241,9 @@ class Danmuku {
|
||||
lockTime: 5,
|
||||
maxLength: 100,
|
||||
minWidth: 0,
|
||||
maxWidth: 0
|
||||
maxWidth: 0,
|
||||
moveOnFullscreen: true,
|
||||
mount: undefined
|
||||
};
|
||||
}
|
||||
static get scheme() {
|
||||
@@ -260,7 +262,9 @@ class Danmuku {
|
||||
lockTime: 'number',
|
||||
maxLength: 'number',
|
||||
minWidth: 'number',
|
||||
maxWidth: 'number'
|
||||
maxWidth: 'number',
|
||||
moveOnFullscreen: 'boolean',
|
||||
mount: '?htmldivelement'
|
||||
};
|
||||
}
|
||||
get isRotate() {
|
||||
@@ -804,8 +808,7 @@ function setting(art, danmuku) {
|
||||
const $danmuOff = getIcon(_danmuOffSvgDefault.default, 'danmu-off');
|
||||
const $danmuConfig = getIcon(_danmuConfigSvgDefault.default, 'danmu-config');
|
||||
const $danmuStyle = getIcon(_danmuStyleSvgDefault.default, 'danmu-config');
|
||||
let $control = $controlsCenter;
|
||||
if (option.mount instanceof Element) $control = option.mount;
|
||||
const $control = option.mount || $controlsCenter;
|
||||
function addEmitter() {
|
||||
const colors = [
|
||||
'#FE0302',
|
||||
@@ -886,9 +889,18 @@ function setting(art, danmuku) {
|
||||
countdown(option.lockTime);
|
||||
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)=>{
|
||||
if (event.key === 'Enter') {
|
||||
@@ -910,11 +922,11 @@ function setting(art, danmuku) {
|
||||
inverseClass(event.target, 'art-current');
|
||||
}
|
||||
});
|
||||
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() {
|
||||
art.controls.add({
|
||||
|
||||
Reference in new issue
Block a user