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

gpui: Add scale style property #24352

Closed
wants to merge 16 commits into from

Conversation

someone13574
Copy link
Contributor

@someone13574 someone13574 commented Feb 6, 2025

Implements scale transformations in GPUI. This doesn't support independent scaling in the x and y directions due to that not being supported by GPUI's text shaping. When an element has the scale property set, it changes its scale relative to its parent.

This PR also switches elements to using a relative coordinate system, where the origin is at the upper-left of the element. Events are also in this relative coordinate system, so an absolute_position property has been added to events so that code such as right-click menus can use it.

Existing code in Zed shouldn't need to many changes to adapt to the new coordinate system. Most code should work as is.

Screencast.from.2025-02-05.23-09-44.webm

TODO:

  • Fix layout_as_root (currently causes Zed to appear broken)
  • Scale children of other styled containers
  • Map positions in FileDropEvent and MouseExitEvent to relative coordinates
  • Fix context menus in Zed (replace position with absolute_position, fix deferred)
  • Document new & modified functions
  • Tailwind methods?

Release Notes:

  • N/A

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 6, 2025
@someone13574 someone13574 changed the title gpui: Add scale to div gpui: Add scale property to div Feb 6, 2025
@someone13574 someone13574 changed the title gpui: Add scale property to div gpui: Add scale style property Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant