chore: Update danmuku plugin to resize and reset displayed danmuku

This commit is contained in:
Harvey Zack committed 2024-05-28 09:02:28 +08:00
1 parent 313b6ae54d
commit e91bcff3a8
3 files changed
+33 -9

No files matched your search

@@ -616,11 +616,22 @@ 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);
}
// 继续弹幕
continue() {