Skip to content

fix: keep repeated content aligned when direction is right - #1

Open
ekruges wants to merge 1 commit into
BuddyWinte:mainfrom
ekruges:fix-right-direction-repeat-gap
Open

fix: keep repeated content aligned when direction is right#1
ekruges wants to merge 1 commit into
BuddyWinte:mainfrom
ekruges:fix-right-direction-repeat-gap

Conversation

@ekruges

@ekruges ekruges commented Aug 31, 2026

Copy link
Copy Markdown

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 -repeatWidth when moving right, so the copies cover the viewport while the original scrolls in
  • updatePosition: wrap at 0 instead of repeatWidth, to match the new range
  • meowquee.ts: pass repeatWidth through to getStartPosition

Both directions now share [-repeatWidth, 0), which also stops setDirection from jumping between them.

getStartPosition takes one new argument. It isn't re-exported from src/index.ts, so the public API is unchanged.

tsc --noEmit, oxlint and rollup -c pass. oxfmt --check already fails on main for README.md and package.json, unrelated to this.

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.
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