fix: chat scroll fix
This commit is contained in:
@@ -42,3 +42,21 @@ export function resolveAutoScrollBehavior(input: AutoScrollDecisionInput): AutoS
|
||||
|
||||
return input.withinInitialGrace ? 'instant' : 'smooth';
|
||||
}
|
||||
|
||||
/** Default pixel distance under which the list is considered stuck to bottom. */
|
||||
export const STICKY_BOTTOM_THRESHOLD = 300;
|
||||
|
||||
/**
|
||||
* Whether the scroll position is close enough to the bottom that the list
|
||||
* should keep auto-pinning to the latest message. Negative distances (rubber
|
||||
* band / overscroll) count as stuck.
|
||||
*
|
||||
* This is the predicate the message list uses to decide whether a content
|
||||
* height change (late image/embed/plugin render) should re-pin to bottom.
|
||||
*/
|
||||
export function isStuckToBottom(
|
||||
distanceFromBottom: number,
|
||||
threshold: number = STICKY_BOTTOM_THRESHOLD
|
||||
): boolean {
|
||||
return distanceFromBottom <= threshold;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user