diff --git a/playlet-lib/src/components/NavBar/NavBar.bs b/playlet-lib/src/components/NavBar/NavBar.bs index 670686dc..9c233000 100644 --- a/playlet-lib/src/components/NavBar/NavBar.bs +++ b/playlet-lib/src/components/NavBar/NavBar.bs @@ -47,6 +47,18 @@ function PopulateButtons() as void m.top.focusable = buttons.Count() > 0 m.top.focusIndex = m.top.focusIndex + + CenterButtons() +end function + +function CenterButtons() + parent = m.buttonGroup.getParent() + parentWidth = parent.width + parentHeight = parent.height + + rect = m.buttonGroup.boundingRect() + + m.buttonGroup.translation = [parentWidth / 2 - rect.width / 2, parentHeight / 2 - rect.height / 2] end function function onKeyEvent(key as string, press as boolean) as boolean