0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-01 23:52:40 +00:00
This commit is contained in:
Trevor Buckner
2024-09-14 18:58:23 -04:00
parent 5c2acf3183
commit 76c9f2ee71
4 changed files with 32 additions and 32 deletions

View File

@@ -57,7 +57,7 @@ const BrewRenderer = (props)=>{
errors : [],
currentEditorCursorPageNum : 0,
currentEditorViewPageNum : 0,
currentBrewRendererPageNum : 0,
currentBrewRendererPageNum : 0,
themeBundle : {},
onPageChange : ()=>{},
...props
@@ -89,13 +89,13 @@ const BrewRenderer = (props)=>{
}));
};
const updateCurrentPage = useCallback(_.throttle((e) => {
const { scrollTop, clientHeight, scrollHeight } = e.target;
const totalScrollableHeight = scrollHeight - clientHeight;
const currentPageNumber = Math.ceil(((scrollTop + 1) / totalScrollableHeight) * rawPages.length);
const updateCurrentPage = useCallback(_.throttle((e)=>{
const { scrollTop, clientHeight, scrollHeight } = e.target;
const totalScrollableHeight = scrollHeight - clientHeight;
const currentPageNumber = Math.ceil(((scrollTop + 1) / totalScrollableHeight) * rawPages.length);
props.onPageChange(currentPageNumber);
}, 200), []);
props.onPageChange(currentPageNumber);
}, 200), []);
const isInView = (index)=>{
if(!state.isMounted)