Skip to content

Commit

Permalink
fix: rerender some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xpadev-net committed Nov 19, 2024
1 parent c2b5e62 commit 35f886a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 >=
Expand Down

0 comments on commit 35f886a

Please sign in to comment.