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

Improve popup menu to leave some margin with window edges #17159

Merged
merged 1 commit into from
Sep 7, 2024

Conversation

huacnlee
Copy link
Contributor

Release Notes:

  • Improved popup menu to leave some margin with window edges.

Updates in GPUI

  • gpui: Add snap_to_window_with_margin method to anchored to support leave margin to window edges.

Before

before-snap-to-window 2024-08-30 222506

After

snap-to-window1 2024-08-30 222506 snap-to-window 2024-08-30 222506

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Aug 30, 2024
@@ -60,6 +60,12 @@ impl Anchored {
self.fit_mode = AnchoredFitMode::SnapToWindow;
self
}

/// Snap to window edge and leave some margins.
pub fn snap_to_window_with_margin(mut self, edges: impl Into<Edges<Pixels>>) -> Self {
Copy link
Contributor Author

@huacnlee huacnlee Aug 30, 2024

Choose a reason for hiding this comment

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

I am not sure if this is the best name, I have considered changing the snap_to_window to add an argument, but sometimes the edge may not a must.

@osiewicz osiewicz merged commit 47aec5e into zed-industries:main Sep 7, 2024
9 checks passed
@osiewicz
Copy link
Contributor

osiewicz commented Sep 7, 2024

Thanks!

@huacnlee huacnlee deleted the better-snap-to-window branch September 7, 2024 02:20
huacnlee added a commit to longbridgeapp/gpui-component that referenced this pull request Sep 7, 2024
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.

2 participants