Selected lit threads glow too

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
tachyonwolf 2026-11-21 09:06:55 -06:00
parent f90427d748
commit 2c6ed11ed3
2 changed files with 21 additions and 7 deletions

View file

@ -61,6 +61,12 @@ static func coarse(rid: RID, pts: PackedVector2Array, color: Color, width: float
RenderingServer.canvas_item_add_polyline(rid, points, PackedColorArray([color]), width, false)
## The glow selected cards have (TableCardSkin), around a selected thread.
static func select_glow(rid: RID, pts: PackedVector2Array) -> void:
line(rid, pts, Color(Style.SELECTED, 0.3), 26.0)
line(rid, pts, Style.SELECTED, 15.0)
## An unlit thread (as PipeLayer._draw_pipe draws it), in its own canvas item.
## `own` is the thread's own colour ("" = the theme's THREAD).
func add_pipe(pts: PackedVector2Array, hovered: bool, own: String = "", selected: bool = false) -> void:
@ -70,9 +76,8 @@ func add_pipe(pts: PackedVector2Array, hovered: bool, own: String = "", selected
if far:
coarse(rid, pts, color, 10.0)
return
if selected: # the glow selected cards have (TableCardSkin)
line(rid, pts, Color(Style.SELECTED, 0.3), 26.0)
line(rid, pts, Style.SELECTED, 15.0)
if selected:
select_glow(rid, pts)
if ThreadStrip.active:
ThreadStrip.active.add_to(rid, pts, color.lightened(0.35) if hovered else color, dark)
ThreadStrip.active.add_pins(item(), pts)

View file

@ -142,7 +142,10 @@ func _draw() -> void:
if not is_ref and not rerouted and e.is_conditional(to):
diamonds.append([pts, lit, e.is_otherwise(to)])
if lit:
(lit_refs if is_ref else lit_list).append(pts)
if is_ref:
lit_refs.append(pts)
else:
lit_list.append([pts, key])
if not is_ref and not rerouted:
var lt := RulesView.pipe_label(e, to, main.data, plain)
if lt != "":
@ -166,8 +169,8 @@ func _draw() -> void:
# Lit pipes go on top so the path of the last roll reads clearly.
for pts in lit_refs:
_draw_ref(pts, true)
for pts in lit_list:
_draw_pipe(pts, true, false)
for lit_pipe: Array in lit_list:
_draw_pipe(lit_pipe[0], true, false, build and lit_pipe[1] == select_key)
for d in diamonds:
_draw_diamond(d[0], d[1], d[2])
var placed: Array[Rect2] = []
@ -248,7 +251,13 @@ func _draw_diamond(pts: PackedVector2Array, lit: bool, otherwise: bool) -> void:
draw_colored_polygon(inner, fill)
func _draw_pipe(pts: PackedVector2Array, lit: bool, hovered: bool) -> void:
func _draw_pipe(pts: PackedVector2Array, lit: bool, hovered: bool, selected: bool = false) -> void:
if selected: # the glow selected cards have (TableCardSkin)
if ThreadStrip.active and not _batch.far:
PipeBatch.select_glow(_batch.item(), pts)
else:
draw_polyline(pts, Color(Style.SELECTED, 0.3), 26.0, true)
draw_polyline(pts, Style.SELECTED, 15.0, true)
if ThreadStrip.active and not _batch.far:
_strip_pipe(pts, lit, hovered)
return