MCPcopy Create free account
hub / github.com/SolarLune/masterplan / Draw

Method Draw

page.go:127–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125}
126
127func (page *Page) Draw() {
128
129 sorted := page.Cards[:]
130
131 for _, card := range sorted {
132 card.DrawShadow()
133 card.DrawLinks()
134 card.DrawCard()
135 }
136
137 for _, card := range sorted {
138 // Undo state creation / capturing can't be handled at the end of Card.DrawContents() like it used to be because that doesn't happen
139 // if the Card is offscreen. Now undo updating happens in its own function here.
140
141 // We handle undos separately so that if drawing the contents of a card changes its properties / triggers an undo update,
142 // that's reflected here.
143 card.HandleUndos()
144 }
145
146 for _, draw := range page.Drawables {
147 if draw.Draw != nil {
148 draw.Draw()
149 }
150 }
151
152 // This needs to be later than Update() so mouse buttons can be consumed in a Card's Draw() loop, for example, before the Selection detects the mouse button press
153 page.Selection.Update()
154
155 page.Selection.Draw()
156
157 for _, toDelete := range page.ToDelete {
158 page.Selection.Remove(toDelete)
159 for index, card := range page.Cards {
160 if card == toDelete {
161 card.Valid = false
162 page.Cards[index] = nil
163 page.Cards = append(page.Cards[:index], page.Cards[index+1:]...)
164 break
165 }
166 }
167 }
168
169 for _, toRestore := range page.ToRestore {
170 // page.Selection.Add(toRestore)
171 page.Cards = append(page.Cards, toRestore)
172 toRestore.Valid = true
173 }
174
175 for _, toRaise := range page.ToRaise {
176
177 for index, other := range page.Cards {
178 if other == toRaise {
179 page.Cards = append(page.Cards[:index], append(page.Cards[index+1:], toRaise)...)
180 break
181 }
182 }
183
184 }

Callers

nothing calls this directly

Calls 12

UpdateLinksMethod · 0.95
DrawShadowMethod · 0.80
DrawLinksMethod · 0.80
DrawCardMethod · 0.80
HandleUndosMethod · 0.80
QuickRenderTextMethod · 0.80
TranslatePointMethod · 0.80
ScaleMethod · 0.80
DrawMethod · 0.65
UpdateMethod · 0.65
RemoveMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected