MCPcopy Create free account
hub / github.com/B33pBeeps/redthread / drawStringSet

Function drawStringSet

internal/app/wire.go:116–151  ·  view source on GitHub ↗

drawStringSet is the shared inner loop. It draws strings whose effective in-front layer matches `inFront`. If `attachToTopID` is set, any string touching that note is forced to the in-front layer so the attachment stays visible on top. If `override` is set, that note's endpoint screen position is re

(c *Canvas, b *Board, hoverIdx int, inFront bool, attachToTopID string, override *PinOverride)

Source from the content-addressed store, hash-verified

114// endpoint screen position is replaced with the override's X/Y (used by
115// the zoom transition so strings follow the morphing rect).
116func drawStringSet(c *Canvas, b *Board, hoverIdx int, inFront bool, attachToTopID string, override *PinOverride) {
117 for i, s := range b.Strings {
118 effectiveInFront := s.InFront
119 if attachToTopID != "" && s.InvolvesNote(attachToTopID) {
120 effectiveInFront = true
121 }
122 if effectiveInFront != inFront {
123 continue
124 }
125 ax, ay, aok := resolveEndpoint(b, &s.A, override)
126 bx, by, bok := resolveEndpoint(b, &s.B, override)
127 if !aok || !bok {
128 continue
129 }
130 col := StringRd
131 attr := uint8(AttrBold)
132 tipGlyph := '◆'
133 wallGlyph := '◉'
134 if i == hoverIdx {
135 col = StringHi
136 tipGlyph = '◈'
137 wallGlyph = '◉'
138 }
139 drawCurve(c, ax, ay, bx, by, s.Tight, col, attr)
140 if s.A.NoteID == "" {
141 c.SetRune(ax, ay, wallGlyph, col, AttrBold)
142 } else {
143 c.SetRune(ax, ay, tipGlyph, col, AttrBold)
144 }
145 if s.B.NoteID == "" {
146 c.SetRune(bx, by, wallGlyph, col, AttrBold)
147 } else {
148 c.SetRune(bx, by, tipGlyph, col, AttrBold)
149 }
150 }
151}
152
153// resolveEndpoint returns an endpoint's screen position, honoring the
154// optional pin override (used by the zoom transition).

Callers 3

drawStringsBehindFunction · 0.85
drawStringsInFrontFunction · 0.85
drawAllStringsFunction · 0.85

Calls 4

resolveEndpointFunction · 0.85
drawCurveFunction · 0.85
InvolvesNoteMethod · 0.80
SetRuneMethod · 0.80

Tested by

no test coverage detected