fix a few thing

This commit is contained in:
MathMan05 committed 2026-02-12 21:12:43 -06:00
1 parent 884da3ec57
commit 54ecec56a7
2 files changed
+9 -4

No files matched your search

+4 -2
View File
@@ -58,11 +58,12 @@ class Channel extends SnowFlake {
set lastreadmessageid(id: string | undefined) {
const cur = this.lastreadmessageidint;
this.lastreadmessageidint = id;
const m = this.messages.get(this.idToPrev.get(cur as string) as string);
const m = this.messages.get(this.idToNext.get(cur as string) as string);
if (m) {
console.log(m);
m.generateMessage();
}
const m2 = this.messages.get(this.idToPrev.get(id as string) as string);
const m2 = this.messages.get(this.idToNext.get(id as string) as string);
if (m2) {
m2.generateMessage();
}
@@ -1268,6 +1269,7 @@ class Channel extends SnowFlake {
if (next) {
next.generateMessage();
}
this.infinite.toBottom();
}
static lastDragDiv = document.createElement("div");
coatDropDiv(div: HTMLDivElement, container: HTMLElement | false = false) {
+5 -2
View File
@@ -128,7 +128,7 @@ class InfiniteScroller {
const nh = elm.target.getBoundingClientRect().height;
const height = heights.get(elm.target);
if (height && nh) {
root.scrollTop -= height - nh;
if (!this.atBottom()) root.scrollTop -= height - nh;
}
heights.set(elm.target, nh);
}
@@ -233,12 +233,15 @@ class InfiniteScroller {
if (this.backElm.get(last) || !this.backElm.has(last)) return false;
return this.scrollBottom < 4;
}
toBottom() {
if (this.div) this.div.scrollTop = this.div.scrollHeight;
}
snapBottom(): () => void {
if (this.div && this.atBottom()) {
const trigger = this.scrollBottom < 4;
return () => {
if (this.div && trigger) this.div.scrollTop = this.div.scrollHeight;
if (this.div && trigger) this.toBottom;
};
} else {
return () => {};