gpui: Improve Anchored to support center position (#47154)

Release Notes:

- N/A

Ref https://github.com/longbridge/gpui-component/pull/1956 extract my
fork version of `anchored.rs` to let GPUI to support position Anchored
at center.


https://github.com/user-attachments/assets/8d0230ed-4b75-440b-b8c3-9bde3decd141

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jason LeeandClaude Sonnet 4.6 authored and GitHub committed 2026-04-21 09:01:42 +00:00
1 parent 81b16f464c
commit 84dcf38dbe
55 files changed
+574 -241

No files matched your search

+2 -2
View File
@@ -11,7 +11,7 @@ use git::{
};
use git_ui::{commit_tooltip::CommitAvatar, commit_view::CommitView, git_status_icon};
use gpui::{
AnyElement, App, Bounds, ClickEvent, ClipboardItem, Corner, DefiniteLength, DragMoveEvent,
Anchor, AnyElement, App, Bounds, ClickEvent, ClipboardItem, DefiniteLength, DragMoveEvent,
ElementId, Empty, Entity, EventEmitter, FocusHandle, Focusable, Hsla, PathBuilder, Pixels,
Point, ScrollStrategy, ScrollWheelEvent, SharedString, Subscription, Task, TextStyleRefinement,
UniformListScrollHandle, WeakEntity, Window, actions, anchored, deferred, point, prelude::*,
@@ -2863,7 +2863,7 @@ impl Render for GitGraph {
deferred(
anchored()
.position(*position)
.anchor(Corner::TopLeft)
.anchor(Anchor::TopLeft)
.child(menu.clone()),
)
.with_priority(1)