Commit Graph

196 Commits

Author SHA1 Message Date
schroda
e3934545b0 Change "large" IconButtons to default size 2025-03-28 19:05:21 +01:00
schroda
7145c33fbb Preserve current page on reader width change only when necessary
The pages only change in size with specific "page scale modes".
Thus, if these modes are not active, the scroll position will not be lost.

There are different cases were even with these modes active, the scroll position won't get lost (e.g. "fit width" while no page is larger than the available width), but handling these would be too cumbersome.

Ideally the relative scroll position would be preserved, however, from testing a little that seems to not work too well
2025-03-27 19:49:53 +01:00
schroda
62bd4fdfb2 Require library entry removal confirmation in reader 2025-03-27 19:49:50 +01:00
schroda
72fb053971 Add "scroll amount" setting 2025-03-27 19:49:49 +01:00
schroda
b93c2d95e5 Add hotkey to close reader 2025-03-27 19:49:44 +01:00
schroda
6f8d5bb9dc Remove unnecessary styling II
Missed in 157a549cc7
2025-03-25 00:04:12 +01:00
schroda
157a549cc7 Remove unnecessary styling 2025-03-24 23:46:57 +01:00
Constantin Piber
541eeb0445 Reader preserve current page on window resize (#905)
* Reader: Reset bounds on window size change

19f2d993 introduced a `minWidth` to make sure sizes are consistent over
chapter changes (or when images load later), but when the window itself
changes, this makes the reader incorrectly sized

* Reader: Update size on navbar width change

This happens mostly when the bar is pinned; same effect as previous
commit

* Reader: Attempt to set the page on resize

It's not perfect, but not changing position at all seems impossible due
to how resizes are handled by the browser (since we adjust our content
to the window size)

* Simplify and abstract reader size reset

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>

* fix: Reader page full width was not properly calculated for static navbar

Only relevant for Fit Content, this did not properly consider the navbar
when the user clamps the content to a custom width

* Refactor: Put reader min sizes to reader itself instead of chapter

This allows some logic simplification.
The `ResizeObserver` can needs to be on an element without restrictions;
previously, the observer would not see the chapter elements get smaller,
since the `min-width` prevented it from shrinking. By applying to the
outer element, we still preserve the centering (since `margin: auto` is
also applied here), but allow the chapter itself to be smaller.

* Reader: Only scroll in continuous reading modes

* Reader: clean up size tracking

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>

* Fixup previous commit stupidness

* Reader: move `minWidth`/`minHeight` back to chapter wrapper

* Apply suggestions from code review

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>

* Also revert `fullWidth` calculation

* Simplify `chapterViewerSize`

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>

* Move size logic entirely to hook

---------

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>
2025-03-24 23:45:06 +01:00
Constantin Piber
c9c1b8625a Reader preserve current page on reader mode change (#906)
* Reader: Re-scroll on reader mode change

* Simplify reading mode restore

https://github.com/Suwayomi/Suwayomi-WebUI/pull/906#discussion_r2009147119

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>

* Move effect as per suggestion

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>

---------

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>
2025-03-24 23:24:36 +01:00
Constantin Piber
1fd7624e98 Fixes places inreader where navbar width was not considered (#908)
* Fixes two places where navbar was not considered

When set to static, the navbar consumes space, so `vw` units are not
enough.
On small screens, the `left`+`transform` approach does not work nicely,
so just use standard flex alignment, the container is already a flexbox.

* Change card also consider wide viewports

* Update src/modules/reader/components/viewer/ReaderTransitionPage.tsx

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>

* Reader: Apply new alignment code also to horizontal scroll mode

---------

Co-authored-by: schroda <50052685+schroda@users.noreply.github.com>
2025-03-24 23:23:50 +01:00
schroda
dc88b42191 Fix preloading of reader pages
There were different issues with the direction the pages got preloaded.

- when resuming a chapter with an initial page > 1, it incorrectly preloaded leading pages instead of trailing ones.
- when going to the previous/next rendered chapter no pages got preloaded at all
2025-03-23 16:40:49 +01:00
schroda
3ca4aa2eff Remove "Settings" from setting page titles 2025-03-17 12:07:02 +01:00
schroda
a85e5584c8 Preserve scroll position continuous pager on previous chapter load
In the horizontal pager loading the previous chapter caused the scroll position to get lost and instead of starting at the end of the previous chapter, the scroll position was at the very start.
This happened everytime no matter if the scroll position was at the x 0 or not before the previous chapter got visible.

Same issue can be observed in the vertical pager in case the scroll position is at y 0 before the previous chapter has been rendered.
2025-02-19 16:43:58 +01:00
schroda
eba3cadb8b Properly detect previous chapter load state
Regression from 174d850093
2025-02-18 02:06:13 +01:00
schroda
0b79f1f82a Extract reader exit button 2025-02-17 03:56:40 +01:00
schroda
95fa09a94a Extract reader bookmark button 2025-02-17 03:51:07 +01:00
schroda
ca7fba0757 Add library button to "ReaderOverlayHeaderMobile" 2025-02-17 03:45:50 +01:00
schroda
419181efa9 Add add/remove to/from library button to reader desktop quick actions 2025-02-17 03:26:44 +01:00
schroda
c6fe715e57 Handle faulty "lastPageRead" values
There seems to be a bug on the server which sets the "lastPageRead" of a chapter to -1 which should not happen
2025-02-12 19:40:43 +01:00
schroda
7e5b3435a9 Fix page centering in paged pagers with preloaded chapters
The previous/next chapter wasn't visible but had a margin which affected the positioning of the visible pages
2025-02-11 02:06:49 +01:00
schroda
a45338647e Fix infinite scroll intersection info calculation
Scrollbars need to be considered since they decrease the available viewport size in which the element can be visible
2025-02-10 22:40:53 +01:00
schroda
eb7397e639 Fix reader image preload for resume "end" mode
In this case the preload direction was incorrect and tried to preload trailing images instead of leading ones
2025-02-10 22:40:52 +01:00
schroda
174d850093 Preload previous/next chapter in reader 2025-02-10 22:40:49 +01:00
schroda
050094c991 Update styling of "manga open source" button 2025-02-08 16:16:32 +01:00
schroda
f633059083 Rename "CustomIconButton" to "CustomButton" 2025-02-08 16:03:37 +01:00
schroda
cae52fd782 Add "blend mode" to "custom color filter" 2025-02-08 01:49:37 +01:00
schroda
9d3aeafe0e Use "BasePager" for infinite scroll chapter change detection
There can be cases where when scrolling backward/forward the first/last page never gets visible in the viewport due to a large width/height of another page.
In that case the intersection observer would never trigger and thus, the chapter wouldn't get changed.

By using the Pager, which always takes up the full width/height, this problem will not be possible, since the start/end of the Pager always enters or leaves the viewport.
2025-02-05 22:25:35 +01:00
schroda
187693ce5a Properly handle not skipping duplicate chapters
The filtered chapter list of the reader state always incorrectly filtered out duplicated chapters even while the setting was disabled
2025-02-05 20:05:36 +01:00
schroda
a32c88a549 Reset "ReaderChapterViewer" min width/height on "ReadingMode" change 2025-02-05 15:48:55 +01:00
schroda
19f2d99345 Center "ReaderChapterViewers"
The viewers can have different sizes which caused theme to not be properly centered.

E.g. for the "vertical mode" in case "chapter 1" is greater in width than "chapter 2", the pages of "chapter 2" were not correctly centered due to the "viewers" having different widths.
2025-02-05 00:34:44 +01:00
schroda
636f48107f Prevent "ReaderChapterViewer" from overlapping each other
Seems like not all browsers handle

width/height: 100%
min-width/min-height: fit-content

correctly.
the "min" setting just never applies and the size is stuck at 100%.
2025-02-04 23:11:34 +01:00
schroda
2ec42d962a Remove context usage from ReaderPage
In case many chapters are rendered, even just the HOC wrapper component re-render due to the context change increases the render time.

Thus, getting rid of these HOC wrapper re-renders by moving the context usage up to the ReaderViewer decreases the render time.
2025-02-03 17:17:35 +01:00
schroda
b01b23b069 Remove context usage from ReaderChapterViewer
In case many chapters are rendered, even just the HOC wrapper component re-render due to the context change increases the render time.

Thus, getting rid of these HOC wrapper re-renders by moving the context usage up to the ReaderViewer decreases the render time.
2025-02-03 17:17:35 +01:00
schroda
4a9d2903b8 Add infinite scroll to reader 2025-02-03 17:17:35 +01:00
schroda
45b4874348 Remove unnecessary keys 2025-02-03 17:17:35 +01:00
schroda
c79ccf3523 Improve memoization of "ReaderTransitionPage"
- use chapter properties instead of chapter object
- only pass "handleBack" in case the transition page is for the first or last chapter
2025-02-03 17:17:35 +01:00
schroda
8ddb259c82 Prevent tooltip on disabled button warning 2025-02-02 00:54:03 +01:00
schroda
b7fc1ae6ff Extract theme context logic into its own provider 2025-01-25 19:22:24 +01:00
schroda
b67c9c4e44 Fix reader chapter transition page positioning in double page mode
Regression 649a17c2ae
2025-01-23 20:36:19 +01:00
schroda
649a17c2ae Move "ReaderTransitionPage" to "ReaderViewer" 2025-01-21 19:19:27 +01:00
schroda
db7aad58ec Convert reader image placeholder styling to vw/vh 2025-01-21 19:19:25 +01:00
schroda
7fad96dab7 Convert reader image styling to vw/vh
Preparation for infinite scroll, since there will be a wrapper which fits its content in width and height, thus, percentage based dimension won't work anymore
2025-01-21 19:19:22 +01:00
schroda
da600bcdec Extract reader pages wrapper styling 2025-01-21 19:19:21 +01:00
schroda
ca1c95cdfe Show chapter transition warning for mobile progress bar open chapter buttons 2025-01-21 19:19:20 +01:00
schroda
b7cb245abc Rename "getImageWidthStyling" to "getReaderImageStyling" 2025-01-18 23:13:56 +01:00
schroda
19f83d5237 Extract hooks from utils file 2025-01-18 22:07:59 +01:00
schroda
8e1d9b3106 Change reader non-static nav bar icon 2025-01-17 01:38:19 +01:00
schroda
d95396ecb0 Consider reader nav bar width and scrollbars for auto scrollbar position 2025-01-17 01:26:09 +01:00
schroda
9ac1009e22 Properly update reader desktop nav bar download button
Did not update according to download updates due to not subscribing to the fragment changes

Regression 257c0c8e10
2025-01-17 01:26:07 +01:00
schroda
97dba923b4 Improve "chapter list" render performance
affected components:
- ChapterList
- ReaderChapterList
2025-01-12 20:28:22 +01:00