Skip to content

hide margins if no overlay text#1951

Open
benomaire wants to merge 1 commit intoquran:mainfrom
benomaire:hidemargins
Open

hide margins if no overlay text#1951
benomaire wants to merge 1 commit intoquran:mainfrom
benomaire:hidemargins

Conversation

@benomaire
Copy link
Copy Markdown
Contributor

No description provided.

Comment on lines +525 to +532
if(!didDraw){
setPadding(horizontalSafeOffset, topSafeOffset, horizontalSafeOffset, bottomSafeOffset);
} else {
setPadding(horizontalSafeOffset,
topBottom + topSafeOffset,
horizontalSafeOffset,
topBottom + bottomSafeOffset);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jazakumAllah khairan - may we move this back into setIsScrollable with a check? this onDraw method gets called every frame, so we want to keep it as light as possible - whereas setIsScrollable just happens once

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am not sure, but I don't see an easy way to move this block back to setIsScrollable, because setIsScrollable is not aware of what happens in onDraw

Some observations:

  • show pages 1 and 2 (landscape, dual page) for the first time, then setIsScrollable is executed 8 times and onDraw is executed 6 times.
  • swipe to pages 3 and 4, then setIsScrollable is executed 2 times and onDraw is executed 4 times (reduces to 2 times when this if block is removed).
  • swipe back to pages 1 and 2, then only setIsScrollable is executed twice.

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