carrito semi saneado
This commit is contained in:
@@ -276,6 +276,9 @@ class ConversationInspector extends HTMLElement {
|
||||
this.rowMap.set(msgId, optItem);
|
||||
this.rowOrder.push(msgId);
|
||||
}
|
||||
|
||||
// Auto-scroll al final
|
||||
list.scrollTop = list.scrollHeight;
|
||||
}
|
||||
|
||||
applyHeights() {
|
||||
|
||||
@@ -197,10 +197,14 @@ class RunTimeline extends HTMLElement {
|
||||
addedOptimistic = true;
|
||||
}
|
||||
|
||||
// auto-scroll solo si agregamos burbujas optimistas nuevas
|
||||
if (addedOptimistic) {
|
||||
// auto-scroll al final cuando hay mensajes nuevos
|
||||
// Solo si el usuario estaba cerca del final (dentro de 150px) o si había optimistas
|
||||
const wasNearBottom = this._lastScrollPosition === undefined ||
|
||||
(log.scrollHeight - this._lastScrollPosition - log.clientHeight) < 150;
|
||||
if (addedOptimistic || wasNearBottom) {
|
||||
log.scrollTop = log.scrollHeight;
|
||||
}
|
||||
this._lastScrollPosition = log.scrollTop;
|
||||
|
||||
requestAnimationFrame(() => this.emitLayout());
|
||||
this.bindScroll(log);
|
||||
@@ -211,6 +215,7 @@ class RunTimeline extends HTMLElement {
|
||||
if (this._scrollBound) return;
|
||||
this._scrollBound = true;
|
||||
log.addEventListener("scroll", () => {
|
||||
this._lastScrollPosition = log.scrollTop;
|
||||
emit("ui:chatScroll", { chat_id: this.chatId, scrollTop: log.scrollTop });
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user