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

Fix menus with borders enabled and popups opening below with less spa… #10566

Closed
wants to merge 1 commit into from

Conversation

ath3
Copy link
Contributor

@ath3 ath3 commented Apr 23, 2024

…ce than needed

fixes #10553

and also fixes:

before:

popup_below_before_border
popup_below_before

after:

menu_selection_popup_after_border
popup_below_after

viewport.height > rel_y + MIN_HEIGHT
} else {
// non-menu popups need 6 height below
viewport.height > rel_y + MIN_HEIGHT + 2
Copy link
Member

Choose a reason for hiding this comment

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

Why the + 2 in the non-memu case?

(child_size.1 <= MIN_HEIGHT && viewport.height > rel_y + MIN_HEIGHT)
|| (child_size.1 > MIN_HEIGHT && viewport.height > rel_y + MIN_HEIGHT + 2)
} else if is_menu {
viewport.height > rel_y + MIN_HEIGHT
Copy link
Member

Choose a reason for hiding this comment

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

Why does the menu without popul case need a special case?

let can_put_below = viewport.height > rel_y + MIN_HEIGHT;
let can_put_below = if is_menu && editor.menu_border() {
// in case of menu borders, we dont want to put it below if it would show two lines less
(child_size.1 <= MIN_HEIGHT && viewport.height > rel_y + MIN_HEIGHT)
Copy link
Member

Choose a reason for hiding this comment

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

J think this is a bit hard to understand. If I understand the code correctly a simpler way to I.plement this would be `let min_height = if is_menu && has_border && child_size.1 > MIN_HEIGHT { MIN_HRIGHT + 2 } else { MIN_HEIGHT };

@ath3 ath3 mentioned this pull request Apr 23, 2024
5 tasks
@pascalkuthe pascalkuthe mentioned this pull request Apr 23, 2024
@ath3 ath3 closed this Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hidden popup items after (Improve popup position #10257)
2 participants