Skip to content

Commit

Permalink
Fix multi-monitor issue for resize handles
Browse files Browse the repository at this point in the history
  • Loading branch information
ManpreetXSingh committed Feb 13, 2024
1 parent f5dd693 commit 0b1b8f4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ui/screen_main/scripts/main_resize_handles.gd
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ func _on_gui_input(event: InputEvent, node: Control):

func _process(_delta: float) -> void:
if resizing:
var current_scene = get_tree().current_scene
var relative_mouse_pos = (
DisplayServer.mouse_get_position()
- DisplayServer.window_get_position(get_window().get_window_id())
)
if resize_node in [$Bottom, $Corner]:
get_window().size.y = int(current_scene.get_global_mouse_position().y)
get_window().size.y = int(relative_mouse_pos.y)
if resize_node in [$Right, $Corner]:
get_window().size.x = int(current_scene.get_global_mouse_position().x)
get_window().size.x = int(relative_mouse_pos.x)

#endregion
###############################################################

0 comments on commit 0b1b8f4

Please sign in to comment.