Improve "MobileReaderProgressBar" progress bar click/drag handling

Convert clicks on the progress bar in such a way, that there is a "padding" around the page "dots".
Thus, e.g. even if the click was actually for page 1, if it is inside page 2 padding, it will behave like it was a click for page 2
This commit is contained in:
schroda
2024-12-28 04:05:29 +01:00
parent bc14b68507
commit 3185449816
5 changed files with 22 additions and 5 deletions

View File

@@ -543,6 +543,7 @@ export class ReaderControls {
pages: ReaderProgressBarProps['pages'],
progressBarPosition: ProgressBarPosition,
getOptionForDirectionFn: typeof getOptionForDirection,
fullSegmentClicks: boolean,
): void {
useEffect(() => {
if (!isDragging) {
@@ -562,6 +563,7 @@ export class ReaderControls {
progressBarRef.current.getBoundingClientRect(),
pages,
isHorizontal,
fullSegmentClicks,
getOptionForDirectionFn,
),
);