Skip to content

Add configurable gap between pages option for webtoon reading - #206

Open
madeindjs wants to merge 2 commits into
max-kammerer:masterfrom
madeindjs:webtoon
Open

Add configurable gap between pages option for webtoon reading#206
madeindjs wants to merge 2 commits into
max-kammerer:masterfrom
madeindjs:webtoon

Conversation

@madeindjs

@madeindjs madeindjs commented Jul 3, 2026

Copy link
Copy Markdown

Add a new 'Gap between pages' appearance setting (PAGE_GAP) that controls the spacing between consecutive pages in continuous/vertical mode. Previously this was a hardcoded 2px constant. Setting it to 0 gives seamless webtoon reading where a single image spans multiple pages without visible separators.

Also fix the debug-only dump() assertion that crashed when scrolling with pageGap=0: sub-pixel float rounding during scroll could make adjacent pages overlap by a fraction of a pixel across their full width, triggering the assertion. Now requires both width and height overlap to exceed 1px before flagging an intersection.

Screenshots

before after
image image
image

madeindjs added 2 commits July 3, 2026 09:14
Add a new 'Gap between pages' appearance setting (PAGE_GAP) that
controls the spacing between consecutive pages in continuous/vertical
mode. Previously this was a hardcoded 2px constant. Setting it to 0
gives seamless webtoon reading where a single image spans multiple
pages without visible separators.

Also fix the debug-only dump() assertion that crashed when scrolling
with pageGap=0: sub-pixel float rounding during scroll could make
adjacent pages overlap by a fraction of a pixel across their full
width, triggering the assertion. Now requires both width and height
overlap to exceed 1px before flagging an intersection.
When the user sets page gap to 0 for seamless webtoon reading, two
remaining visual artifacts are now fixed:

- Suppress the page border (DRAW_PAGE_BORDER) when pageGap=0, since the
  1px black hairline stroke is counterproductive for seamless pages.

- Make adjacent pages overlap by 1px internally (pageGap=-1) when the
  user sets 0, preventing the white View background from showing
  through sub-pixel gaps during scroll (visible as a blinking white
  line on dark pages).

- Raise the dump() assertion threshold to >2px (both dimensions) to
  accommodate the intentional 1px overlap plus float rounding, while
  still catching genuine page overlaps.
@madeindjs
madeindjs marked this pull request as ready for review July 3, 2026 07:56
@max-kammerer

Copy link
Copy Markdown
Owner

@madeindjs Thank you for contribution!

  1. You use the legacy mechanism for property updates — there is a newer one: pref(...) returns a Preference<T> : LiveData<T> (prefs/Preference.kt:20), with DRAW_PAGE_BORDER as a neighbouring example (GlobalOptions.kt:244) and subscribers using .observe(...) (view/OrionStatusBar.kt:39, OrionViewerActivity.kt:110).

    Two consequences of the current approach: the new value is only applied to pages that are (re)added afterwards, so already laid out pages keep the old gap until they scroll off screen and are recreated; and globalOptions.pageGap is read from SharedPreferences in the draw hot path (PageView.kt:279), which does a getString() plus a parse per page per frame. Preference/LiveData caches the value and notifies observers, which solves both.

  2. I think it's worth looking for another approach instead of the 1px overlap and the relaxed assertion. It could stay as a temporary workaround in the meantime.

  3. There is a dedicated checkbox for border drawing, and I'd prefer not to mix that logic with the gap.

  4. You use pixels — dp would probably be a better unit here.

  5. Two attributes in user_pref_appearance.xml have no effect and can be dropped: app:showSeekBarValue belongs to androidx SeekBarPreference and does nothing on OrionEditTextPreference, and android:inputType isn't read by EditTextPreference — the input type is already set in OrionEditPreference.kt:100. If you did want a slider, there is prefs/SeekBarPreferenceAsText.kt, which persists an int as a string exactly as needed here.

@max-kammerer

Copy link
Copy Markdown
Owner

@madeindjs please also use https://github.com/max-kammerer/orion-viewer/blob/master/docs/architecture.md. Feel free to ask any questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants