Groups: an optional groups list on a collection (frame rect, collapsed,
members, details), saved by TowerBoard and kept by JsonIO. Expanded groups
draw a frame behind their cards with a title bar; collapsed ones become one
compact card that lists the members' lit results, with pipes re-routed to
its inlet and right edge. Build mode adds multi-select (Ctrl/Shift-click,
Ctrl-drag), Group (Ctrl+G), drop in/out of frames, rename, ungroup, delete
with undo and a details editor.
Templates: TemplateKit saves cards, groups or selections with relative
positions, internal pipes and outside pipes by name, detects {$name}
parameters and inserts with fresh ids. TemplateLibrary keeps user templates
in user://templates and lists the built-in ones in templates/.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.3 KiB
GDScript
43 lines
1.3 KiB
GDScript
class_name ChevronButton
|
|
extends Button
|
|
## Collapse/expand toggle: a chevron pointing down when open, right when collapsed.
|
|
|
|
var open: bool = true:
|
|
set(value):
|
|
open = value
|
|
queue_redraw()
|
|
## Drawn in light colours for the felt (see use_felt_colors).
|
|
var on_felt := false
|
|
|
|
|
|
func _init() -> void:
|
|
custom_minimum_size = Vector2(26, 26)
|
|
flat = false
|
|
focus_mode = FOCUS_ALL
|
|
var normal := Style.box(Color(0, 0, 0, 0), 6)
|
|
var hover := Style.box(Color("#e6dfcd"), 6)
|
|
Style.skin_button(self, normal, hover, hover, Style.MUTED)
|
|
mouse_entered.connect(queue_redraw)
|
|
mouse_exited.connect(queue_redraw)
|
|
|
|
|
|
func _draw() -> void:
|
|
var c := size / 2.0
|
|
var pts: PackedVector2Array
|
|
if open:
|
|
pts = PackedVector2Array([c + Vector2(-4, -2), c + Vector2(0, 2), c + Vector2(4, -2)])
|
|
else:
|
|
pts = PackedVector2Array([c + Vector2(-2, -4), c + Vector2(2, 0), c + Vector2(-2, 4)])
|
|
if on_felt:
|
|
draw_polyline(pts, Style.ON_FELT if is_hovered() else Style.ON_FELT_MUTED, 2.0, true)
|
|
else:
|
|
draw_polyline(pts, Style.INK if is_hovered() else Style.MUTED, 2.0, true)
|
|
|
|
|
|
## Light colours, for a chevron on the felt (group title bars).
|
|
func use_felt_colors() -> void:
|
|
on_felt = true
|
|
var normal := Style.box(Color(0, 0, 0, 0), 6)
|
|
var hover := Style.box(Color(1, 1, 1, 0.08), 6)
|
|
Style.skin_button(self, normal, hover, hover, Style.ON_FELT_MUTED)
|
|
queue_redraw()
|