From c16bd1e39dc59f6449c6187e1696c62079a96522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=83=9F=E6=B1=90=E5=BF=86=E6=A2=A6=5FYM?= <140093497+Yanxiyimengya@users.noreply.github.com> Date: Wed, 18 Feb 2026 20:57:12 +0800 Subject: [PATCH] Fix the split_handle sticking issue --- addons/dockable_container/split_handle.gd | 41 ++++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/addons/dockable_container/split_handle.gd b/addons/dockable_container/split_handle.gd index baf4b1f..4777e29 100644 --- a/addons/dockable_container/split_handle.gd +++ b/addons/dockable_container/split_handle.gd @@ -32,19 +32,34 @@ func _draw() -> void: func _gui_input(event: InputEvent) -> void: if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT: - _dragging = event.is_pressed() - if event.double_click: - layout_split.percent = 0.5 - elif _dragging and event is InputEventMouseMotion: - var mouse_in_parent := get_parent_control().get_local_mouse_position() - if layout_split.is_horizontal(): - layout_split.percent = ( - (mouse_in_parent.x - _parent_rect.position.x) / _parent_rect.size.x - ) - else: - layout_split.percent = ( - (mouse_in_parent.y - _parent_rect.position.y) / _parent_rect.size.y - ) + if event.pressed: + _dragging = true + if event.double_click: + layout_split.percent = 0.5 + accept_event() + + +func _input(event: InputEvent) -> void: + if not _dragging: + return + if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT: + if not event.is_pressed(): + _dragging = false + get_viewport().set_input_as_handled() + elif event is InputEventMouseMotion: + if (event.button_mask & MOUSE_BUTTON_MASK_LEFT) == 0: + _dragging = false + return + _perform_resize_logic() + get_viewport().set_input_as_handled() + + +func _perform_resize_logic() -> void: + var mouse_in_parent := get_parent_control().get_local_mouse_position() + if layout_split.is_horizontal(): + layout_split.percent = ((mouse_in_parent.x - _parent_rect.position.x) / _parent_rect.size.x) + else: + layout_split.percent = ((mouse_in_parent.y - _parent_rect.position.y) / _parent_rect.size.y) func _notification(what: int) -> void: