Skip to content

feat(useCanvasContext): new function #1373

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

Closed
wants to merge 9 commits into from

Conversation

michealroberts
Copy link
Contributor

@michealroberts michealroberts commented Mar 7, 2022

Description

So this PR solves the usual setup of a canvas object, whilst simultaneously making it reactive to it's background element (utilising functionality from the useElementBoundin() composable).

Closes #1346

Additional context

If this PR is acceptable, I will also extend to another 3D rendering context composable (webgl), as well as PR'ing an integration for three.js if there is an appetite for it.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

Suggested amends for simplifying the useCanvas2D composable. Includes additional changes to index.md documentation and demo usage, as well as DocString updates.
@michealroberts
Copy link
Contributor Author

@okxiaoliang4 Updated PR with implementations of your suggested amends. Thanks :D

@michealroberts michealroberts changed the title feat(useCanvas2D): new function feat(useCanvasContext): new function Mar 28, 2022
@michealroberts
Copy link
Contributor Author

Hey @okxiaoliang4 I've now refactored the code with your suggestions and I have also added dual support for '2d' and 'webgl' contexts as these are the most widely used.

@okxiaoliang4
Copy link
Member

@michael-observerly Hi, I have initiated a pr in your warehouse to see if this can solve your needs. It has better type hints and less code.
michealroberts#2

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.

proposal: useCanvas2D()
2 participants