Skip to content

Commit 2ec7499

Browse files
CopilotLexian-droid
andcommitted
Add bounds checking for popup positioning when popup is larger than window
Co-authored-by: Lexian-droid <83799577+Lexian-droid@users.noreply.github.com>
1 parent 7dd7b29 commit 2ec7499

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

addons/flowkit/ui/editor.gd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ func _popup_centered_on_editor(popup: Window) -> void:
8989
# Calculate centered position within the editor window
9090
var centered_pos: Vector2i = window_pos + (window_size - popup_size) / 2
9191

92+
# Ensure popup stays within editor window bounds (handle case where popup is larger than window)
93+
centered_pos.x = maxi(centered_pos.x, window_pos.x)
94+
centered_pos.y = maxi(centered_pos.y, window_pos.y)
95+
9296
# Set the popup position and show it
9397
popup.position = centered_pos
9498
popup.popup()

0 commit comments

Comments
 (0)