mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-16 09:36:16 -08:00
chore: Update danmuku plugin to resize and reset displayed danmuku
This commit is contained in:
1 parent
313b6ae54d
commit
e91bcff3a8
3 files changed
+33
-9
No files matched your search
@@ -548,11 +548,24 @@ export default class Danmuku {
|
||||
return this;
|
||||
}
|
||||
|
||||
// 重置正在显示的弹幕
|
||||
// 重置正在显示的弹幕: stop/emit 状态的弹幕
|
||||
resize() {
|
||||
this.filter('emit', (danmu) => {
|
||||
//
|
||||
});
|
||||
const { clientWidth } = this.$player;
|
||||
|
||||
function callback(danmu) {
|
||||
switch (danmu.mode) {
|
||||
// 滚动的弹幕
|
||||
case 0:
|
||||
const translateX = clientWidth + danmu.$ref.clientWidth;
|
||||
danmu.$ref.style.transform = `translateX(${-translateX}px)`;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.filter('stop', callback);
|
||||
this.filter('emit', callback);
|
||||
}
|
||||
|
||||
// 继续弹幕
|
||||
|
||||
Reference in new issue
Block a user