mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
update
This commit is contained in:
1 parent
755c6dc36a
commit
cba10856da
3 files changed
+33
-9
No files matched your search
@@ -1,15 +1,19 @@
|
||||
function getData(clientWidth, item) {
|
||||
function getData(ins, clientLeft, clientWidth, item) {
|
||||
const top = item.$ref.offsetTop;
|
||||
const left = item.$ref.offsetLeft;
|
||||
const left = ins.getLeft(item.$ref) - clientLeft;
|
||||
const height = item.$ref.clientHeight;
|
||||
const width = item.$ref.clientWidth;
|
||||
const distance = left + width;
|
||||
const right = clientWidth - distance;
|
||||
const speed = distance / item.$restTime;
|
||||
const mode = item.mode;
|
||||
const time = item.$restTime;
|
||||
const $ref = item.$ref;
|
||||
|
||||
return {
|
||||
$ref,
|
||||
mode,
|
||||
time,
|
||||
top,
|
||||
left,
|
||||
height,
|
||||
@@ -21,10 +25,11 @@ function getData(clientWidth, item) {
|
||||
}
|
||||
|
||||
export default function getDanmuTop(ins, danmu) {
|
||||
const clientLeft = ins.getLeft(ins.$player);
|
||||
const { clientWidth, clientHeight } = ins.$player;
|
||||
const { antiOverlap } = ins.option;
|
||||
const { marginBottom, marginTop } = ins;
|
||||
const target = getData(clientWidth, danmu);
|
||||
const target = getData(ins, clientLeft, clientWidth, danmu);
|
||||
|
||||
const danmus = ins.queue
|
||||
.filter((item) => {
|
||||
@@ -35,7 +40,7 @@ export default function getDanmuTop(ins, danmu) {
|
||||
item.$ref.offsetTop <= clientHeight - marginBottom
|
||||
);
|
||||
})
|
||||
.map((item) => getData(clientWidth, item))
|
||||
.map((item) => getData(ins, clientLeft, clientWidth, item))
|
||||
.sort((prev, next) => prev.top - next.top);
|
||||
|
||||
if (danmus.length === 0) {
|
||||
@@ -87,6 +92,14 @@ export default function getDanmuTop(ins, danmu) {
|
||||
}
|
||||
}
|
||||
|
||||
// const test = topMap.map((list) => {
|
||||
// return list.map((item) => {
|
||||
// return target.speed * item.time;
|
||||
// });
|
||||
// });
|
||||
|
||||
console.log(topMap);
|
||||
|
||||
if (antiOverlap) {
|
||||
switch (target.mode) {
|
||||
case 0:
|
||||
|
||||
Reference in new issue
Block a user