fix: keep repeated content aligned when direction is right - #1
Open
ekruges wants to merge 1 commit into
Open
Conversation
Repeat copies are appended after the original content, so nothing occupies the track to its left. Scrolling right started at position 0 and moved the track away from the viewport's left edge, opening a blank stretch that grew to almost a full repeat width before snapping back. Start a full repeat behind when moving right and wrap at 0, so the copies cover the viewport while the original scrolls in.
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.
Repeat copies are appended after the original content, so nothing sits to its left. Scrolling right started at position 0 and slid the track off the viewport's left edge, leaving a blank stretch that grew to nearly a full repeat width before snapping back. Scrolling left is unaffected, since it walks negative and pulls the copies across.
Repro:
new Meowquee(el, { direction: 'right' }).getStartPosition: start at-repeatWidthwhen moving right, so the copies cover the viewport while the original scrolls inupdatePosition: wrap at0instead ofrepeatWidth, to match the new rangemeowquee.ts: passrepeatWidththrough togetStartPositionBoth directions now share
[-repeatWidth, 0), which also stopssetDirectionfrom jumping between them.getStartPositiontakes one new argument. It isn't re-exported fromsrc/index.ts, so the public API is unchanged.tsc --noEmit,oxlintandrollup -cpass.oxfmt --checkalready fails onmainforREADME.mdandpackage.json, unrelated to this.