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

feat(ui): canvas tool cleanup & perf #7044

Merged
merged 7 commits into from
Oct 6, 2024

Conversation

psychedelicious
Copy link
Collaborator

Summary

  • Tidy some messy parts of CanvasToolModule
  • Add some typo insurance
  • Revised cursor tracking - track both relative and absolute positions and use Konva's built-in API to get the relative position.
  • Fix an edge case with the color picker, and throttle it to improve performance.

Related Issues / Discussions

n/a

QA Instructions

n/a

Merge Plan

n/a

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

- Record both absolute and relative positions
- Use simpler method to get relative position
- Generalize getColorUnderCursor to be getColorAtCoordinate
The color picker take some time to sample the color from the canvas state. This could cause a race condition where the cursor position changes between the time sampling starts, resulting in the picker showing the wrong color. Sometimes it picks up the color picker tool preview!

To resolve this, the color picker's color syncing is now throttled to once per animation frame. Besides fixing the incorrect color issue, it improves the perf substantially by reducing number of samples we take.
@github-actions github-actions bot added frontend-deps PRs that change frontend dependencies frontend PRs that change frontend files labels Oct 6, 2024
@hipsterusername hipsterusername merged commit e0b6355 into main Oct 6, 2024
14 checks passed
@hipsterusername hipsterusername deleted the psyche/feat/ui/canvas-tool-cleanup branch October 6, 2024 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files frontend-deps PRs that change frontend dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants