Skip to content

Commit

Permalink
fix ooc autoscroll
Browse files Browse the repository at this point in the history
  • Loading branch information
stonedDiscord committed Dec 7, 2023
1 parent 209f466 commit 5b3928b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion webAO/client/appendICLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function appendICLog(
clientLog.appendChild(entry);

if (clientLog.scrollTop+clientLog.offsetHeight+120>clientLog.scrollHeight)
clientLog.scrollTo(0, clientLog.scrollHeight);
clientLog.scrollTo(0, clientLog.scrollHeight);

setLastICMessageTime(new Date());
}
5 changes: 2 additions & 3 deletions webAO/packets/handlers/handleCT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ export const handleCT = (args: string[]) => {
message = message.replace(/\n/g, "<br>");

oocLog.innerHTML += `${username}: ${message}<br>`;
if (oocLog.scrollTop > oocLog.scrollHeight - 600) {
oocLog.scrollTop = oocLog.scrollHeight;
}
if (oocLog.scrollTop+oocLog.offsetHeight+120>oocLog.scrollHeight)
oocLog.scrollTo(0, oocLog.scrollHeight);
}
}

Expand Down

0 comments on commit 5b3928b

Please sign in to comment.