Skip to content

Commit

Permalink
fix: detect when not scrolled at bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
KatoakDR committed Jan 14, 2024
1 parent 2b0bd27 commit 5eb8656
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions electron/renderer/components/game-content/game-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ const emptyLogLine: GameLogLine = {
*/
const emptyLogLineRegex = /^(>?)(\n+)$/;

/**
* For the 'scroll' event to fire on the element, the overflow
* property must be set. We rely on this to know if the user has
* scrolled to the bottom (and we should engage in auto-scrolling)
* or if they have scrolled away from the bottom (and we should
* not auto-scroll).
*/
const scrollablePanelStyles = css({
overflowY: 'scroll',
height: '100%',
});

const filterDuplicateEmptyLines: rxjs.MonoTypeOperatorFunction<GameLogLine> = (
observable: rxjs.Observable<GameLogLine>
) => {
Expand Down Expand Up @@ -178,6 +190,7 @@ export const GameContent: React.FC<GameContentProps> = (
return (
<EuiPanel
panelRef={scrollableRef}
css={scrollablePanelStyles}
paddingSize="none"
hasBorder={false}
hasShadow={false}
Expand Down

0 comments on commit 5eb8656

Please sign in to comment.