Repository navigation
fix(reader): eliminate cover-mode page-turn flash - #1352
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In DIVINA Cover mode, tapping to turn the page visibly flashes in the area uncovered by the outgoing page: the revealed page looks like it was not loaded ahead of time and fades/pops in as the current page slides away.
Root cause
Three compounding issues in the cover deck (
NativeCoverPageViewon iOS/tvOS and macOS):alphafrom 0 to 1. Idle neighbor slots were laid out withisHidden = trueandalpha = 0, andupdateSlotLayout()setalpha = 1insideUIView.animate(andanimator().alphaValueon macOS). As the front page slid off, the page underneath faded in from the background over the whole turn duration.applyPagePresentationInvalidationskippedisHiddenslots, so when the next/previous page finished preloading while reading, the slot holding it never received the decoded image. It only pulled and prepared (rotate/border-crop/split) the image synchronously at the moment the turn began..beginFromCurrentStatein the same transaction could read a stale presentation position and flash the incoming page on top of the current one.Fix
adoptNeighbor): keep idle neighbor slots composited underneath the opaque front slot (frontzIndex2, next 1, previous 0) instead of hiding them or settingalpha = 0.alpha/alphaValuemutations from slot layout entirely; only the moving slot's frame and shadow animate.item != nil) regardless ofisHidden, so preloaded images and translation overlays are already prepared while idle.isHidden, and keep mouse/touch hit-testing and accessibility scoped to the active front slot (isUserInteractionEnabled+accessibilityElementsHiddenon iOS/tvOS;NativeCoverSlotView.hitTestreturningnilfor inactive slots +setAccessibilityHiddenon macOS, since AppKit hit-testing walkssubviewsand ignoreslayer.zPosition).CATransaction.flush()) on iOS before sliding in.isVisibleflag fromNativeCoverSlotView.Configurationand the unusedsetPlaybackActivehelper, and record the cover-deck compositing invariant in therepo-conventionsskill.Validation
make formatmake build— iOS, macOS, and tvOS all built successfully.