Skip to content

A quick proposition for the context menu #9

@Sam-Online

Description

@Sam-Online

I'd propose to change a few lines of code, change the method: "func _context_update(window : Window, control : Control) -> void:" in "plugins/script_spliter/core/builder.gd" to:

func _context_update(window : Window, control : Control) -> void:
	if is_instance_valid(window) and is_instance_valid(control):
		var mouse_pos: Vector2 = DisplayServer.mouse_get_position()
		
		var screen_rect: Rect2 = DisplayServer.screen_get_usable_rect(window.current_screen)
		var gvp: Vector2 = control.get_screen_position() + control.get_local_mouse_position()
		gvp.y = min(gvp.y, screen_rect.position.y + screen_rect.size.y - window.size.y + 16.0)
		gvp.x = min(gvp.x, screen_rect.position.x + screen_rect.size.x - window.size.x + 16.0)
		window.set_deferred("position", gvp)

with this the context menu show up in the right screen in multi-monitor setup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions