From 3d51c8c8bacc163bf2b44993484fabbf4e2dbd66 Mon Sep 17 00:00:00 2001 From: tachyonwolf Date: Sat, 21 Nov 2026 09:03:28 -0600 Subject: [PATCH] Threads pick within 8 screen px of the line at any zoom Co-Authored-By: Claude Sonnet 5.5 --- ui/board_view.gd | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ui/board_view.gd b/ui/board_view.gd index 46f90ce..cc3a432 100644 --- a/ui/board_view.gd +++ b/ui/board_view.gd @@ -14,6 +14,8 @@ const FAR_ZOOM := 0.22 ## roll on a click; their names show as tooltips (CardShield). const COMPACT_ZOOM := 0.45 const WORLD_SIZE := 40000.0 +## How far (screen pixels) from a thread's line a click or hover still picks it. +const PIPE_HIT_RADIUS := 8.0 var main: Main var world: Control @@ -203,6 +205,11 @@ func world_mouse() -> Vector2: return world.get_local_mouse_position() +## The pipe under the mouse, within PIPE_HIT_RADIUS screen pixels of its line. +func pipe_under_mouse() -> String: + return pipes.pipe_at(world_mouse(), PIPE_HIT_RADIUS / zoom) + + func screen_to_world(p: Vector2) -> Vector2: return (p - world.position) / zoom @@ -316,7 +323,7 @@ func _gui_input(ev: InputEvent) -> void: if f is LineEdit or f is TextEdit: f.release_focus() if build_left: - var key := pipes.pipe_at(world_mouse(), 11.0) if main.mode == Main.Mode.BUILD else "" + var key := pipe_under_mouse() if main.mode == Main.Mode.BUILD else "" if key != "": # The pipe opens in the inspector (Main.open_pipe_options). main.open_pipe_options(key, mb.global_position) @@ -359,7 +366,7 @@ func _gui_input(ev: InputEvent) -> void: MOUSE_BUTTON_RIGHT: if mb.pressed: # A thread under the mouse, else the empty spread. - var key := pipes.pipe_at(world_mouse(), 11.0) + var key := pipe_under_mouse() var list := Actions.thread(main, key) if key != "" else Actions.background(main, world_mouse()) if not list.is_empty(): Actions.popup_at(main, list, mb.global_position) @@ -385,7 +392,7 @@ func _gui_input(ev: InputEvent) -> void: elif _panning: world.position += mm.relative elif main.mode == Main.Mode.BUILD: - pipes.hover_key = pipes.pipe_at(world_mouse(), 11.0) + pipes.hover_key = pipe_under_mouse() mouse_default_cursor_shape = CURSOR_POINTING_HAND if pipes.hover_key != "" else CURSOR_ARROW return var pan := ev as InputEventPanGesture