Skip to content

sud.getMenuButtonBoundingClientRect ​

Synchronously gets the position and size of the menu button in the top-right corner, so game content can avoid overlapping it.

javascript
const rect = sud.getMenuButtonBoundingClientRect();

Parameters ​

None.

Return Value ​

Object | null. Returns null if the menu button position is unavailable. Check for a value before reading its properties.

Coordinates are relative to the top-left corner of the screen. All values below are in pixels (px).

PropertyTypeDescription
widthnumberMenu button width
heightnumberMenu button height
topnumberTop edge coordinate
rightnumberRight edge coordinate
bottomnumberBottom edge coordinate
leftnumberLeft edge coordinate

Usage Notes ​

Confirm that the target app provides menu button position information before using it. This API returns synchronously and does not use callbacks or a Promise. If the game uses a different coordinate system, convert these values to that system before using them for layout.

Example ​

javascript
const rect = sud.getMenuButtonBoundingClientRect();

if (rect) {
  console.log('Menu button position', rect.left, rect.top, rect.width, rect.height);
} else {
  console.log('Menu button position is unavailable');
}