Skip to content

getMenuButtonBoundingClientRect ​

同步向游戏返回宿主右上角胶囊按钮的位置和尺寸。坐标原点为游戏 View 的左上角,坐标和尺寸的单位均为物理像素(px)。

方法声明 ​

java
MenuButtonBoundingClientRect getMenuButtonBoundingClientRect();

global.sud.op.runtime.client.model.MenuButtonBoundingClientRect

字段类型说明
widthint宽度,单位 px
heightint高度,单位 px
topint上边界,单位 px
rightint右边界,单位 px
bottomint下边界,单位 px
leftint左边界,单位 px

布局完成后,取胶囊相对游戏 View 的边界。若用 getLocationOnScreen() 测量两个 View,则胶囊的左右边界各减去游戏 View 的 x 坐标,上下边界各减去游戏 View 的 y 坐标,宽高取胶囊的实测值。

例如,胶囊的屏幕边界 (left, top, right, bottom) 为 (774, 120, 1032, 216),游戏 View 的屏幕原点为 (24, 60),则返回 (750, 60, 1008, 156),宽高为 258 × 96 px。