-
Notifications
You must be signed in to change notification settings - Fork 154
feat: scroll, scrollTo #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR adds a new scrollTo functionality to the GhostCursor and updates documentation accordingly.
- Added documentation for the scrollTo function in README.md.
- Extended the GhostCursor interface and implemented the scrollTo function in src/spoof.ts.
- Introduced a new ScrollToOptions interface.
Reviewed Changes
| File | Description |
|---|---|
| README.md | Added documentation for the new scrollTo function |
| src/spoof.ts | Added ScrollToOptions interface, updated GhostCursor interface, and implemented scrollTo |
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
src/spoof.ts
Outdated
| : { top: destination.y, left: destination.x } | ||
|
|
||
| window.scrollTo({ | ||
| behavior: optionsResolved.behavior ?? (defaultOptions?.scrollIntoView?.scrollSpeed !== undefined && |
Copilot
AI
Mar 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The page.evaluate callback references 'optionsResolved' and 'defaultOptions' which are not passed into its scope; this may lead to undefined behavior. Consider passing the required values as arguments to the evaluate function.
|
The problem with this is that it's easily detectible by hooking into |
|
@Niek done, refactored to use the same scroll method as |
| } | ||
| }, | ||
|
|
||
| async scroll (delta: Partial<Vector>, options?: ScrollOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically just moved this code (unchanged) to its own function that is called by both scrollTo and scrollIntoView
|
Amazing! Merged now! |
No description provided.