mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
update
This commit is contained in:
1 parent
235b235245
commit
43fb02c4cc
3 files changed
+63
-54
No files matched your search
@@ -1,5 +1,6 @@
|
||||
export default function getDanmuTop(ins, danmu) {
|
||||
const { $player } = ins.art.template;
|
||||
const { clientWidth, clientHeight } = ins.$player;
|
||||
const { antiOverlap } = ins.option;
|
||||
|
||||
const danmus = ins.queue
|
||||
.filter((item) => {
|
||||
@@ -7,7 +8,7 @@ export default function getDanmuTop(ins, danmu) {
|
||||
item.$ref &&
|
||||
item.$state === 'emit' &&
|
||||
item.mode === danmu.mode &&
|
||||
item.$ref.offsetTop <= $player.clientHeight - ins.marginBottom
|
||||
item.$ref.offsetTop <= clientHeight - ins.marginBottom
|
||||
);
|
||||
})
|
||||
.map((item) => {
|
||||
@@ -16,7 +17,7 @@ export default function getDanmuTop(ins, danmu) {
|
||||
left: item.$ref.offsetLeft,
|
||||
height: item.$ref.clientHeight,
|
||||
width: item.$ref.clientWidth,
|
||||
right: $player.clientWidth - item.$ref.offsetLeft - item.$ref.clientWidth,
|
||||
right: clientWidth - item.$ref.offsetLeft - item.$ref.clientWidth,
|
||||
};
|
||||
})
|
||||
.sort((prev, next) => prev.top - next.top);
|
||||
@@ -30,15 +31,15 @@ export default function getDanmuTop(ins, danmu) {
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: ins.marginTop,
|
||||
width: $player.clientWidth,
|
||||
width: clientWidth,
|
||||
});
|
||||
|
||||
danmus.push({
|
||||
top: $player.clientHeight - ins.marginBottom,
|
||||
top: clientHeight - ins.marginBottom,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: ins.marginBottom,
|
||||
width: $player.clientWidth,
|
||||
width: clientWidth,
|
||||
});
|
||||
|
||||
for (let index = 1; index < danmus.length; index += 1) {
|
||||
@@ -66,24 +67,28 @@ export default function getDanmuTop(ins, danmu) {
|
||||
}
|
||||
}
|
||||
|
||||
switch (danmu.mode) {
|
||||
case 0:
|
||||
topMap.sort((prev, next) => {
|
||||
const nextMinRight = Math.min(...next.map((item) => item.right));
|
||||
const prevMinRight = Math.min(...prev.map((item) => item.right));
|
||||
return nextMinRight * next.length - prevMinRight * prev.length;
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
topMap.sort((prev, next) => {
|
||||
const nextMaxWidth = Math.max(...next.map((item) => item.width));
|
||||
const prevMaxWidth = Math.max(...prev.map((item) => item.width));
|
||||
return prevMaxWidth * prev.length - nextMaxWidth * next.length;
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (antiOverlap) {
|
||||
//
|
||||
} else {
|
||||
switch (danmu.mode) {
|
||||
case 0:
|
||||
topMap.sort((prev, next) => {
|
||||
const nextMinRight = Math.min(...next.map((item) => item.right));
|
||||
const prevMinRight = Math.min(...prev.map((item) => item.right));
|
||||
return nextMinRight * next.length - prevMinRight * prev.length;
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
topMap.sort((prev, next) => {
|
||||
const nextMaxWidth = Math.max(...next.map((item) => item.width));
|
||||
const prevMaxWidth = Math.max(...prev.map((item) => item.width));
|
||||
return prevMaxWidth * prev.length - nextMaxWidth * next.length;
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return topMap[0][0].top;
|
||||
return topMap[0][0].top;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user