From 35f886ae2c589ddaadffee31d5565f53370f4462 Mon Sep 17 00:00:00 2001 From: xpadev Date: Tue, 19 Nov 2024 12:58:25 +0900 Subject: [PATCH] fix: rerender some comments --- src/main.ts | 6 ++++-- src/utils/comment.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index 7e7a85d5..f140cde7 100755 --- a/src/main.ts +++ b/src/main.ts @@ -196,7 +196,7 @@ class NiconiComments { */ private getCommentPos(data: IComment[], end: number, lazy = false) { const getCommentPosStart = performance.now(); - if (this.processedCommentIndex + 1 >= end) return; + if (this.processedCommentIndex >= end) return; for (const comment of data.slice(this.processedCommentIndex, end)) { if (comment.invisible || (comment.posY > -1 && !lazy)) continue; if (comment.loc === "naka") { @@ -356,7 +356,9 @@ class NiconiComments { if (comment.invisible) { continue; } - this.getCommentPos(this.comments, comment.index + 1); + if (comment.posY < 0) { + this.getCommentPos(this.comments, comment.index); + } comment.draw(vpos, this.showCollision, cursor); } } diff --git a/src/utils/comment.ts b/src/utils/comment.ts index 1edbd933..bad8f2d1 100755 --- a/src/utils/comment.ts +++ b/src/utils/comment.ts @@ -605,6 +605,7 @@ const processFixedComment = ( const posY = lazy ? -1 : getFixedPosY(comment, collision); for (let j = 0; j < comment.long; j++) { const vpos = comment.vpos + j; + if (timeline[vpos]?.includes(comment)) continue; arrayPush(timeline, vpos, comment); if (j > comment.long - 20) continue; arrayPush(collision, vpos, comment); @@ -631,7 +632,7 @@ const processMovableComment = ( for (let j = beforeVpos, n = comment.long + 125; j < n; j++) { const vpos = comment.vpos + j; const leftPos = getPosX(comment.comment, vpos); - if (timeline[vpos]?.includes(comment)) break; + if (timeline[vpos]?.includes(comment)) continue; arrayPush(timeline, vpos, comment); if ( leftPos + comment.width + config.collisionPadding >=