()
| 125 | } |
| 126 | |
| 127 | func (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 | } |
nothing calls this directly
no test coverage detected