MCPcopy
hub / github.com/g3n/engine / recalc

Method recalc

gui/image_button.go:255–267  ·  view source on GitHub ↗

recalc recalculates all dimensions and position from inside out

()

Source from the content-addressed store, hash-verified

253
254// recalc recalculates all dimensions and position from inside out
255func (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}

Callers 4

SetTextMethod · 0.95
SetIconMethod · 0.95
SetFontSizeMethod · 0.95
NewImageButtonFunction · 0.45

Calls 5

ContentWidthMethod · 0.80
ContentHeightMethod · 0.80
WidthMethod · 0.65
HeightMethod · 0.65
SetPositionMethod · 0.65

Tested by

no test coverage detected