recalc recalculates all dimensions and position from inside out
()
| 253 | |
| 254 | // recalc recalculates all dimensions and position from inside out |
| 255 | func (b *ImageButton) recalc() { |
| 256 | |
| 257 | // Only need to recal if there's a label preset |
| 258 | if b.label != nil { |
| 259 | width := b.Panel.ContentWidth() |
| 260 | height := b.Panel.ContentHeight() |
| 261 | |
| 262 | x := (width - b.label.Width()) / 2 |
| 263 | y := (height - b.label.Height()) / 2 |
| 264 | |
| 265 | b.label.SetPosition(x, y) |
| 266 | } |
| 267 | } |
no test coverage detected