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).
| Property | Type | Description |
|---|---|---|
| width | number | Menu button width |
| height | number | Menu button height |
| top | number | Top edge coordinate |
| right | number | Right edge coordinate |
| bottom | number | Bottom edge coordinate |
| left | number | Left 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');
}