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

perf(edgeless): remove edgeless CSS variable to increase performance #4939

Merged
merged 9 commits into from
Oct 9, 2023

Conversation

doouding
Copy link
Member

@doouding doouding commented Sep 28, 2023

Zoom in/out or change the viewport of the edgeless will update the CSS variables like --affine-edgeless-x, --affine-edgeless-y, --affine-zoom, and so on. Each time those variables are updated, the browser needs to recalculate all its descendants' styles even if those descendants does not use any of the variable.

The solution is simple, remove the variable and just use those values in JavaScript directly.

Before
Screenshot 2023-09-28 at 4 48 10 PM

After
Screenshot 2023-09-28 at 4 50 05 PM

Change

  • remove edgeless viewport CSS variables, using translateX, translateY, and zoom from edgeless.surface.viewport along with the edgeless.slots.viewportUpdated should be sufficient for most scenarios.
  • slicer bug after refactoring of surface block

@vercel
Copy link

vercel bot commented Sep 28, 2023

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

Name Status Preview Comments Updated (UTC)
blocksuite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2023 9:11am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
blocksuite-docs ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2023 9:11am

@doouding doouding marked this pull request as ready for review October 9, 2023 09:20
@doodlewind doodlewind added the notable Major improvement worth emphasizing label Oct 9, 2023
Copy link
Member

@doodlewind doodlewind left a comment

Choose a reason for hiding this comment

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

Thanks for the optimization!

@doodlewind doodlewind merged commit d756557 into master Oct 9, 2023
19 checks passed
@doodlewind doodlewind deleted the perf/edgeless branch October 9, 2023 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notable Major improvement worth emphasizing
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants