Skip to content
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

Camera tests #3720

Closed
wants to merge 6 commits into from
Closed

Camera tests #3720

wants to merge 6 commits into from

Conversation

Taha-Hassan-Git
Copy link
Contributor

@Taha-Hassan-Git Taha-Hassan-Git commented May 8, 2024

This PR adds tests for camera panning and pinching.

It simulates touch events necessary for panning and zooming by dispatching events to the browser. I could encapsulate this logic into a fixture or functions to use in other tests if it felt useful. Something like gesture.pinch({start: {}, end: {}, steps: number}), gesture.pan({start: {}, end: {}, steps: number}).

It simulates trackpad pinching by dispatching a scroll wheel event, though I haven't been able to work out the relationship between pixels scrolled and zoom speed. It also seems important to await each scroll event in steps for some reason.

Change Type

  • sdk — Changes the tldraw SDK
  • dotcom — Changes the tldraw.com web app
  • docs — Changes to the documentation, examples, or templates.
  • vs code — Changes to the vscode plugin
  • internal — Does not affect user-facing stuff
  • bugfix — Bug fix
  • feature — New feature
  • improvement — Improving existing features
  • chore — Updating dependencies, other boring stuff
  • galaxy brain — Architectural changes
  • tests — Changes to any test code
  • tools — Changes to infrastructure, CI, internal scripts, debugging tools, etc.
  • dunno — I don't know

Test Plan

  1. Add a step-by-step description of how to test your PR here.
  • Unit Tests
  • End to end tests

Release Notes

  • Add a brief release note for your PR here.

Copy link

vercel bot commented May 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
examples ✅ Ready (Inspect) Visit Preview May 8, 2024 11:51am
1 Ignored Deployment
Name Status Preview Updated (UTC)
tldraw-docs ⬜️ Ignored (Inspect) Visit Preview May 8, 2024 11:51am

await mouse.wheel(0, 15) // 0.9
await mouse.wheel(0, 15) // 0.81
await mouse.wheel(0, 15) // 0.72
await keyboard.up('Control')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is odd, if I await a single mouse.wheel event, even if I set the delta y to 1000000, it only zooms to 0.9. It maxes out at 15 pixels, any more and there is no further change.

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.

None yet

1 participant