Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement synchronous horizontal scroll #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhmylove
Copy link

Addresses #102

Implemented new behaviour parameter: syncXScroll which is disabled by default.
When active, it synchronizes horizontal position of all active pages

@zhmylove zhmylove force-pushed the dev/zhmylove/syncXScroll branch from 4493228 to 25f1a56 Compare December 23, 2024 09:49
@@ -138,6 +138,9 @@ class GlobalOptions(
val isSwapKeys: Boolean
get() = getBooleanProperty(SWAP_KEYS, false)

val isSyncXScroll: Boolean
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhmylove here you use old Orion's approach to work with properties, it doesn't reflect changes in setting until application restart. Please take a look on DRAW_PAGE_BORDER property below, it defines OBSERVABLE property that listens all changes in settings

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll update this part of code soon

activePages.forEach {
if (it.isOnScreen) {
if (first)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change in doScrollAndDoRendering is clear, but this one is not. Could you please elaborate it?

Copy link
Author

@zhmylove zhmylove Jan 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed that orion-viewer does something like prefetch of the pages: it loads around 3 extra pages to the direction of scrolling and changes in doScrollAndDoRendering properly sync their X-position.

The problem was with other pages being loaded during scrolling. I failed setting their X-position in uploadPrevPage and uploadNextPage, nor inside addPageInPosition — those functions just ignored it and new pages (4+ pages below) got improper position. So the only solution I came across is to synchronize X-position for all the pages being rendered in renderVisiblePages

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