feat(ads): carry the banner scroll position across navigation
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 49s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 57s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 49s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 57s
Per the owner's idea: instead of moving the banner out of the per-screen header (which would change its position), remember the banner's "life stage" and resume it on the next screen. The engine already keeps the message + rotation timing; this adds the scroll offset: - bannerEngine tracks the in-flight scroll (target, duration, start). On attach, if a scroll is still running, it computes the current offset and calls the new host's resumeScroll(fromTx, toPx, remaining) — the view jumps to the carried offset and continues to the end over the remaining time, instead of restarting at the left. - A finished scroll is left at its end; the rotator's own loop then takes over. Verified: spot-checked in the browser (a long message at offset -785 resumes at -788 on the next screen, not 0) and unit-tested (attach mid-scroll calls resumeScroll with a partial offset and the remaining duration).
This commit is contained in:
@@ -68,6 +68,10 @@ export interface BannerHost {
|
||||
overflowPx(): number;
|
||||
/** Animate the horizontal scroll to toPx over durationMs. */
|
||||
scrollTo(toPx: number, durationMs: number): void;
|
||||
/** Resume an in-flight scroll on a freshly-mounted view: jump to fromTx (px, signed) instantly,
|
||||
* then continue to toPx over durationMs. Used by the engine on attach to carry the scroll
|
||||
* position across a navigation; the rotator itself never calls it. */
|
||||
resumeScroll(fromTx: number, toPx: number, durationMs: number): void;
|
||||
}
|
||||
|
||||
export interface Rotator {
|
||||
|
||||
Reference in New Issue
Block a user